@@ -66,8 +66,8 @@ def ogrConnectionString(self, uri):
6666 if not ok :
6767 break
6868
69- dsUri .setUsername ( user )
70- dsUri .setPassword ( passwd )
69+ dsUri .setUsername (user )
70+ dsUri .setPassword (passwd )
7171
7272 if not conn :
7373 raise RuntimeError ('Could not connect to PostgreSQL database - check connection info' )
@@ -76,6 +76,35 @@ def ogrConnectionString(self, uri):
7676 QgsCredentials .instance ().put (conninfo , user , passwd )
7777
7878 ogrstr = "PG:%s" % dsUri .connectionInfo ()
79+ elif provider == "oracle" :
80+ # OCI:user/password@host:port/service:table
81+ dsUri = QgsDataSourceURI (layer .dataProvider ().dataSourceUri ())
82+ ogrstr = "OCI:"
83+ if dsUri .username () != "" :
84+ ogrstr += dsUri .username ()
85+ if dsUri .password () != "" :
86+ ogr += "/" + dsUri .password ()
87+ delim = "@"
88+
89+ if dsUri .host () != "" :
90+ ogrstr += delim + dsUri .host ()
91+ delim = ""
92+ if dsUri .port () != "" and dsUri .port () != 1521 :
93+ ogrstr += ":%d" % dsUri .port ()
94+ ogrstr += "/"
95+ if dsUri .database () != "" :
96+ ogrstr += dsUri .database ()
97+ elif dsUri .database () != "" :
98+ ogrstr += delim + dsUri .database ()
99+
100+ if ogrstr == "OCI:" :
101+ raise RuntimeError ('Invalid oracle data source - check connection info' )
102+
103+ ogrstr += ":"
104+ if dsUri .schema () != "" :
105+ ogrstr += dsUri .schema () + "."
106+
107+ ogrstr += dsUri .table ()
79108 else :
80109 ogrstr = unicode (layer .source ()).split ("|" )[0 ]
81110
0 commit comments