mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
DBBrowserDB: Fix transaction logic in execute{Multi}SQL
Create a restore point in executeSQL and executeMultiSQL instead of just setting the dirty flag. This way the changes made using these functions are not applied immediately when no restore point was created yet.
This commit is contained in:
@@ -343,7 +343,7 @@ bool DBBrowserDB::executeSQL ( const QString & statement, bool dirtyDB, bool log
|
||||
|
||||
if (_db){
|
||||
if (logsql) logSQL(statement, kLogMsg_App);
|
||||
if (dirtyDB) setDirty(true);
|
||||
if (dirtyDB) setRestorePoint();
|
||||
if (SQLITE_OK==sqlite3_exec(_db,statement.toUtf8(),
|
||||
NULL,NULL,&errmsg)){
|
||||
ok=true;
|
||||
@@ -368,6 +368,10 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
|
||||
if(log)
|
||||
logSQL(statement, kLogMsg_App);
|
||||
|
||||
// Set DB to dirty/create restore point if necessary
|
||||
if(dirty)
|
||||
setRestorePoint();
|
||||
|
||||
// Show progress dialog
|
||||
int statement_size = statement.size();
|
||||
QProgressDialog progress(QObject::tr("Executing SQL..."),
|
||||
@@ -417,10 +421,6 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
|
||||
}
|
||||
} while(tail && *tail != 0 && (res == SQLITE_OK || res == SQLITE_DONE));
|
||||
|
||||
// Set dirty flag
|
||||
if(dirty)
|
||||
setDirty(true);
|
||||
|
||||
// Exit
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user