Fix transactions not being ignored when executing SQL (#656)

* Fix transactions not being ignored when executing SQL

* Fix transactions not being ignored when importing from SQL

* Fix Travis build error

* Fix Travis build error
This commit is contained in:
Iulian Onofrei
2016-07-24 14:55:16 +03:00
committed by Justin Clift
parent 3a8fdafdf4
commit d03aef1e35
2 changed files with 9 additions and 3 deletions

View File

@@ -898,6 +898,8 @@ void MainWindow::executeQuery()
if (query.isEmpty())
return;
query = query.remove(QRegExp("^\\s*BEGIN TRANSACTION;|COMMIT;\\s*$"));
//log the query
db.logSQL(query, kLogMsg_User);
sqlite3_stmt *vm;

View File

@@ -616,16 +616,20 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
if(!isOpen())
return false;
QString query = statement;
query.remove(QRegExp("^\\s*BEGIN TRANSACTION;|COMMIT;\\s*$"));
// Log the statement if needed
if(log)
logSQL(statement, kLogMsg_App);
logSQL(query, kLogMsg_App);
// Set DB to dirty/create restore point if necessary
if(dirty)
setSavepoint();
// Show progress dialog
int statement_size = statement.size();
int statement_size = query.size();
QProgressDialog progress(tr("Executing SQL..."),
tr("Cancel"), 0, statement_size);
progress.setWindowModality(Qt::ApplicationModal);
@@ -633,7 +637,7 @@ bool DBBrowserDB::executeMultiSQL(const QString& statement, bool dirty, bool log
// Execute the statement by looping until SQLite stops giving back a tail string
sqlite3_stmt* vm;
QByteArray utf8Query = statement.toUtf8();
QByteArray utf8Query = query.toUtf8();
const char *tail = utf8Query.data();
int res = 0;
unsigned int line = 0;