Skip to content

Commit bfe2413

Browse files
authoredOct 4, 2018
Merge pull request #8101 from elpaso/bugfix-various-dbmanager-query-time-rows
[db-manager] Fix some unreported issues in the SQL dialog
2 parents 031efeb + 947a199 commit bfe2413

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed
 

‎python/plugins/db_manager/db_plugins/connector.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ def _rollback(self):
172172
raise ConnectionError(e)
173173

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

179177
def _get_cursor_columns(self, c):

‎python/plugins/db_manager/db_plugins/data_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ def __init__(self, db, sql, parent=None):
192192

193193
t = QTime()
194194
t.start()
195-
c = self.db._execute(None, str(sql))
196-
self._secs = t.elapsed() / 1000.0
197-
del t
195+
c = self.db._execute(None, sql)
198196

199197
self._affectedRows = 0
200198
data = []
@@ -205,7 +203,7 @@ def __init__(self, db, sql, parent=None):
205203
try:
206204
if len(header) > 0:
207205
data = self.db._fetchall(c)
208-
self._affectedRows = c.rowcount
206+
self._affectedRows = len(data)
209207
except DbError:
210208
# nothing to fetch!
211209
data = []
@@ -216,7 +214,9 @@ def __init__(self, db, sql, parent=None):
216214
# commit before closing the cursor to make sure that the changes are stored
217215
self.db._commit()
218216
c.close()
217+
self._secs = t.elapsed() / 1000.0
219218
del c
219+
del t
220220

221221
def secs(self):
222222
return self._secs

‎python/plugins/db_manager/dlg_sql_layer_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def executeSql(self):
260260
# set the new model
261261
model = self.db.sqlResultModel(sql, self)
262262
self.viewResult.setModel(model)
263-
self.lblResult.setText(self.tr("{0} rows, {1:.1f} seconds").format(model.affectedRows(), model.secs()))
263+
self.lblResult.setText(self.tr("{0} rows, {1:.3f} seconds").format(model.affectedRows(), model.secs()))
264264
cols = self.viewResult.model().columnNames()
265265
for col in cols:
266266
quotedCols.append(self.db.connector.quoteId(col))

0 commit comments

Comments
 (0)
Please sign in to comment.