Skip to content

Commit

Permalink
Optimize column information
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Dec 21, 2020
1 parent a277cc6 commit 3a2b8f8
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Expand Up @@ -104,16 +104,29 @@ def _execute(self, sql=None):
return
self._debug("execute called with sql " + self.sql)
try:
self.result = self._toStrResultSet(self.connection.executeSql(self.sql, feedback=self.feedback))
result = self.connection.execSql(self.sql, feedback=self.feedback)
self._description = [] # reset description
self.result = self._toStrResultSet(result.rows())
for c in result.columns():
self._description.append([
c, # name
'', # type_code
-1, # display_size
-1, # internal_size
-1, # precision
None, # scale
True # null_ok
])

except QgsProviderConnectionException as e:
self._description = None
raise DbError(e, self.sql)
self._debug("execute returned " + str(len(self.result)) + " rows")
self.cursor = 0

self._description = None # reset description

@property
def description(self):
"""Returns columns description, it should be already set by _execute"""

if self._description is None:

Expand Down

0 comments on commit 3a2b8f8

Please sign in to comment.