Set savepoint before logging the SQL statement

Otherwise the sequence of savepoint and update statement is inverted in the
SQL log.

See issue  #1859
This commit is contained in:
mgrojo
2020-06-21 17:56:43 +02:00
parent 3485a52e16
commit f4d78ad786
+2 -2
View File
@@ -1002,8 +1002,8 @@ bool DBBrowserDB::executeSQL(const std::string& statement, bool dirtyDB, bool lo
return false;
}
if (logsql) logSQL(QString::fromStdString(statement), kLogMsg_App);
if (dirtyDB) setSavepoint();
if (logsql) logSQL(QString::fromStdString(statement), kLogMsg_App);
char* errmsg;
if (SQLITE_OK == sqlite3_exec(_db, statement.c_str(), callback ? callbackWrapper : nullptr, &callback, &errmsg))
@@ -1422,8 +1422,8 @@ bool DBBrowserDB::updateRecord(const sqlb::ObjectIdentifier& table, const std::s
else
sql += "sqlb_make_single_value(" + sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ",") + ")=" + sqlb::escapeString(rowid.toStdString());
logSQL(QString::fromStdString(sql), kLogMsg_App);
setSavepoint();
logSQL(QString::fromStdString(sql), kLogMsg_App);
// If we get a NULL QByteArray we insert a NULL value, and for that
// we can pass NULL to sqlite3_bind_text() so that it behaves like sqlite3_bind_null()