Skip to content
Permalink
Browse files

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 870d078479352d61edd902ab9d2ca48e98db9148
@@ -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()
@@ -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))
@@ -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()
@@ -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:

0 comments on commit 870d078

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