Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 bfe2413
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions python/plugins/db_manager/db_plugins/connector.py
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/db_manager/db_plugins/data_model.py
Expand Up @@ -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 = []
Expand All @@ -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 = []
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/db_manager/dlg_sql_layer_window.py
Expand Up @@ -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))
Expand Down

0 comments on commit bfe2413

Please sign in to comment.