Skip to content
Permalink
Browse files

Merge pull request #8101 from elpaso/bugfix-various-dbmanager-query-t…

…ime-rows

[db-manager] Fix some unreported issues in the SQL dialog
  • Loading branch information
elpaso committed Oct 4, 2018
2 parents 031efeb + 947a199 commit bfe24130198c4c037cf2a5a19d40ba57c2bc49a1
@@ -172,8 +172,6 @@ def _rollback(self):
raise ConnectionError(e)

except self.execution_error_types() as e:
# do the rollback to avoid a "current transaction aborted, commands ignored" errors
self._rollback()
raise DbError(e)

def _get_cursor_columns(self, c):
@@ -192,9 +192,7 @@ def __init__(self, db, sql, parent=None):

t = QTime()
t.start()
c = self.db._execute(None, str(sql))
self._secs = t.elapsed() / 1000.0
del t
c = self.db._execute(None, sql)

self._affectedRows = 0
data = []
@@ -205,7 +203,7 @@ def __init__(self, db, sql, parent=None):
try:
if len(header) > 0:
data = self.db._fetchall(c)
self._affectedRows = c.rowcount
self._affectedRows = len(data)
except DbError:
# nothing to fetch!
data = []
@@ -216,7 +214,9 @@ def __init__(self, db, sql, parent=None):
# commit before closing the cursor to make sure that the changes are stored
self.db._commit()
c.close()
self._secs = t.elapsed() / 1000.0
del c
del t

def secs(self):
return self._secs
@@ -260,7 +260,7 @@ def executeSql(self):
# set the new model
model = self.db.sqlResultModel(sql, self)
self.viewResult.setModel(model)
self.lblResult.setText(self.tr("{0} rows, {1:.1f} seconds").format(model.affectedRows(), model.secs()))
self.lblResult.setText(self.tr("{0} rows, {1:.3f} seconds").format(model.affectedRows(), model.secs()))
cols = self.viewResult.model().columnNames()
for col in cols:
quotedCols.append(self.db.connector.quoteId(col))

0 comments on commit bfe2413

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