Skip to content
Permalink
Browse files

Fix quotes on postgis import, & fix mysql datsource formatting

(cherry-picked from 53cbe26)
  • Loading branch information
stev-0 authored and nyalldawson committed Aug 8, 2018
1 parent 1c51d69 commit 2e0576c419e7bde6999cb8cd8d14f9bb8d092d15
@@ -317,6 +317,22 @@ def ogrConnectionStringAndFormatFromLayer(layer):

ogrstr = "PG:%s" % dsUri.connectionInfo()
format = 'PostgreSQL'
elif provider == 'mssql':
#'dbname=\'db_name\' host=myHost estimatedmetadata=true
# srid=27700 type=MultiPolygon table="dbo"."my_table"
# #(Shape) sql='
dsUri = layer.dataProvider().uri()
ogrstr = 'MSSQL:'
ogrstr += 'database={0};'.format(dsUri.database())
ogrstr += 'server={0};'.format(dsUri.host())
if dsUri.username() != "":
ogrstr += 'uid={0};'.format(dsUri.username())
else:
ogrstr += 'trusted_connection=yes;'
if dsUri.password() != '':
ogrstr += 'pwd={0};'.format(dsUri.password())
ogrstr += 'tables={0}'.format(dsUri.table())
format = 'MSSQL'
elif provider == "oracle":
# OCI:user/password@host:port/service:table
dsUri = QgsDataSourceUri(layer.dataProvider().dataSourceUri())
@@ -234,9 +234,7 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
arguments.append('"' + shapeEncoding + '"')
arguments.append('-f')
arguments.append('PostgreSQL')
arguments.append('PG:"')
arguments.append(self.getConnectionString(parameters, context))
arguments.append('"')
arguments.append('PG:' + self.getConnectionString(parameters, context))
arguments.append(dimstring)
arguments.append(ogrLayer)
arguments.append(layername)

0 comments on commit 2e0576c

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