Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
db manager: also add newline when adding a unique id field (fixes #19343
)
  • Loading branch information
jef-n committed Jul 5, 2018
1 parent a0b6dc2 commit 870d078
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/oracle/plugin.py
Expand Up @@ -197,7 +197,7 @@ def toSqlLayer(self, sql, geomCol, uniqueCol,
uri = self.uri()
con = self.database().connector

uri.setDataSource(u"", u"({})".format(sql), geomCol, filter, uniqueCol.strip(u'"'))
uri.setDataSource(u"", u"({}\n)".format(sql), geomCol, filter, uniqueCol.strip(u'"'))
if avoidSelectById:
uri.disableSelectAtId(True)
provider = self.dbplugin().providerName()
Expand All @@ -207,7 +207,7 @@ def toSqlLayer(self, sql, geomCol, uniqueCol,
if not vlayer.isValid():

wkbType, srid = con.getTableMainGeomType(
u"({})".format(sql), geomCol)
u"({}\n)".format(sql), geomCol)
uri.setWkbType(wkbType)
if srid:
uri.setSrid(unicode(srid))
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/plugin.py
Expand Up @@ -274,7 +274,7 @@ def toSqlLayer(self, sql, geomCol, uniqueCol, layerName="QueryLayer", layerType=
q = 1
while "_subq_%d_" % q in sql:
q += 1
sql = "SELECT %s AS _uid_,* FROM (%s) AS _subq_%d_" % (uniqueFct, sql, q)
sql = u"SELECT %s AS _uid_,* FROM (%s\n) AS _subq_%d_" % (uniqueFct, sql, q)
uniqueCol = "_uid_"

uri = self.uri()
Expand All @@ -293,7 +293,7 @@ def registerAllActions(self, mainWindow):
def registerSubPluginActions(self, mainWindow):
# load plugins!
try:
exec (u"from .%s.plugins import load" % self.dbplugin().typeName(), globals())
exec(u"from .%s.plugins import load" % self.dbplugin().typeName(), globals())
except ImportError:
pass
else:
Expand Down

0 comments on commit 870d078

Please sign in to comment.