Skip to content

Commit 05db901

Browse files
committed
Set savepoint before logging the SQL statement
Otherwise the sequence of savepoint and update statement is inverted in the SQL log. See issue #1859
1 parent 221f1bc commit 05db901

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/sqlitedb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,8 @@ bool DBBrowserDB::executeSQL(const std::string& statement, bool dirtyDB, bool lo
10021002
return false;
10031003
}
10041004

1005-
if (logsql) logSQL(QString::fromStdString(statement), kLogMsg_App);
10061005
if (dirtyDB) setSavepoint();
1006+
if (logsql) logSQL(QString::fromStdString(statement), kLogMsg_App);
10071007

10081008
char* errmsg;
10091009
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
14221422
else
14231423
sql += "sqlb_make_single_value(" + sqlb::joinStringVector(sqlb::escapeIdentifier(pks), ",") + ")=" + sqlb::escapeString(rowid.toStdString());
14241424

1425-
logSQL(QString::fromStdString(sql), kLogMsg_App);
14261425
setSavepoint();
1426+
logSQL(QString::fromStdString(sql), kLogMsg_App);
14271427

14281428
// If we get a NULL QByteArray we insert a NULL value, and for that
14291429
// we can pass NULL to sqlite3_bind_text() so that it behaves like sqlite3_bind_null()

0 commit comments

Comments
 (0)