Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make CursorAdapter more generic (directly use AbstractConnection)
  • Loading branch information
strk committed Jan 9, 2020
1 parent 95cb05e commit ae8f359
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Expand Up @@ -73,14 +73,11 @@ def __init__(self, connection, sql=None):
self._execute()

def _toStrResultSet(self, res):
#print("XXX type of QVariant(None) is " + str(type(QVariant(None))))
newres = []
for rec in res:
newrec = []
for col in rec:
#print("XXX col of rec of resultset valued " + str(col)+ " is typed " + str(type(col)))
if type(col) == type(QVariant(None)):
#print("XXX qvariant type of " + str(col)+ " is " + str(col.type))
if (str(col) == 'NULL'):
col = None
else:
Expand All @@ -97,7 +94,7 @@ def _execute(self, sql=None):
if (self.sql == None):
return
self._debug("execute called with sql " + self.sql)
self.result = self._toStrResultSet(self.connection._executeSql(self.sql))
self.result = self._toStrResultSet(self.connection.executeSql(self.sql))
self._debug("execute returned " + str(len(self.result)) + " rows")
self.cursor = 0
self.description = []
Expand Down Expand Up @@ -1121,15 +1118,15 @@ def _execute(self, cursor, sql):
if cursor != None:
cursor._execute(sql)
return cursor
return CursorAdapter(self, sql)
return CursorAdapter(self.core_connection, sql)

def _executeSql(self, sql):
return self.core_connection.executeSql(sql)

def _get_cursor(self, name=None):
#if name is not None:
# print("XXX _get_cursor called with a Name: " + name)
return CursorAdapter(self, name)
return CursorAdapter(self.core_connection, name)

def _commit(self):
pass
Expand Down

0 comments on commit ae8f359

Please sign in to comment.