Permalink
Browse files

Improve error messages when importing SQL files

When executing multiple SQL statements at once, e.g. when importing an
SQL file (but not in the Execute SQL tab!), and hitting an error save
the error message before reverting the transaction. This preserves the
error message which is otherwise replaced by "not an error" because the
rollback doesn't fail.
  • Loading branch information...
MKleusberg committed May 16, 2018
1 parent aebfc51 commit 431c67138ba22445f42a6d95a638fd90284a442b
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/sqlitedb.cpp
@@ -808,13 +808,13 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
return false;
}
} else {
if(dirty)
revertToSavepoint(savepoint_name);
lastErrorMessage = tr("Error in statement #%1: %2.\nAborting execution%3.")
.arg(line)
.arg(sqlite3_errmsg(_db))
.arg(dirty ? tr(" and rolling back") : "");
qWarning() << lastErrorMessage;
if(dirty)
revertToSavepoint(savepoint_name);
return false;
}
}

0 comments on commit 431c671

Please sign in to comment.