@@ -66,8 +66,8 @@ def ogrConnectionString(self, uri):
66
66
if not ok :
67
67
break
68
68
69
- dsUri .setUsername ( user )
70
- dsUri .setPassword ( passwd )
69
+ dsUri .setUsername (user )
70
+ dsUri .setPassword (passwd )
71
71
72
72
if not conn :
73
73
raise RuntimeError ('Could not connect to PostgreSQL database - check connection info' )
@@ -76,6 +76,35 @@ def ogrConnectionString(self, uri):
76
76
QgsCredentials .instance ().put (conninfo , user , passwd )
77
77
78
78
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 ()
79
108
else :
80
109
ogrstr = unicode (layer .source ()).split ("|" )[0 ]
81
110
0 commit comments