Skip to content
Permalink
Browse files

processing: fix interpretation of oracle layers (fixes #12590)

Funded by norbit.de
  • Loading branch information
jef-n committed Apr 20, 2015
1 parent 085d0ad commit f0daab9c7c188bd0361d7d11652830558231e1b6
Showing with 31 additions and 2 deletions.
  1. +31 −2 python/plugins/processing/algs/gdal/OgrAlgorithm.py
@@ -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')
@@ -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]

0 comments on commit f0daab9

Please sign in to comment.
You can’t perform that action at this time.