Improve error handling in execution of SQL commands

This improves the error handling when executing multiple SQL commands at
once in a couple of ways.

We didn't detect any sort of possible error. For example syntax error
were reported and execution stopped but constraint errors were just
silently ignored. This is fixed now so that no silent errors should
occur.

Also we would execute the statements one after another until hitting an
error and then just stop, even if a savepoint was created before. With
this commit we're now reverting back to this savepoint and telling the
user about this. This should bring the database back to a consistent
state.

We have to remove any transaction statements from the SQL statements
because we're always already in a transactions and they can't be nested.
However, when removing a BEGIN TRANSACTION statement this would happen
silently and not in all cases a savepoint would be created instead. This
is fixed as well by making sure a savepoint is always created by this
function when a transaction was in the original list of commands.

See issues #955 and #957.
This commit is contained in:
Martin Kleusberg
2017-01-31 19:05:21 +01:00
parent 036e4349e0
commit 665837ff25
2 changed files with 42 additions and 9 deletions
+2
View File
@@ -102,6 +102,8 @@ public:
QVector<QPair<QString, QString>> queryColumnInformation(const QString& object_name);
QString generateSavepointName(const QString& identifier = QString()) const;
sqlite3 * _db;
objectMap objMap;