Skip to content

Commit

Permalink
processing: fix interpretation of oracle layers (fixes #12590)
Browse files Browse the repository at this point in the history
Funded by norbit.de
  • Loading branch information
jef-n committed Apr 20, 2015
1 parent 085d0ad commit f0daab9
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions python/plugins/processing/algs/gdal/OgrAlgorithm.py
Expand Up @@ -66,8 +66,8 @@ def ogrConnectionString(self, uri):
if not ok:
break

dsUri.setUsername( user )
dsUri.setPassword( passwd )
dsUri.setUsername(user)
dsUri.setPassword(passwd)

if not conn:
raise RuntimeError('Could not connect to PostgreSQL database - check connection info')
Expand All @@ -76,6 +76,35 @@ def ogrConnectionString(self, uri):
QgsCredentials.instance().put(conninfo, user, passwd)

ogrstr = "PG:%s" % dsUri.connectionInfo()
elif provider == "oracle":
# OCI:user/password@host:port/service:table
dsUri = QgsDataSourceURI(layer.dataProvider().dataSourceUri())
ogrstr = "OCI:"
if dsUri.username() != "":
ogrstr += dsUri.username()
if dsUri.password() != "":
ogr += "/" + dsUri.password()
delim = "@"

if dsUri.host() != "":
ogrstr += delim + dsUri.host()
delim = ""
if dsUri.port() != "" and dsUri.port() != 1521:
ogrstr += ":%d" % dsUri.port()
ogrstr += "/"
if dsUri.database() != "":
ogrstr += dsUri.database()
elif dsUri.database() != "":
ogrstr += delim + dsUri.database()

if ogrstr == "OCI:":
raise RuntimeError('Invalid oracle data source - check connection info')

ogrstr += ":"
if dsUri.schema() != "":
ogrstr += dsUri.schema() + "."

ogrstr += dsUri.table()
else:
ogrstr = unicode(layer.source()).split("|")[0]

Expand Down

0 comments on commit f0daab9

Please sign in to comment.