aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:54:15 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:54:15 -0400
commit6d3d39356473078c6b47e03b8a7616e4b34de928 (patch)
treefe5be2e6a08e4cfc73207746aba4c9fccfecfa10 /SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
parentf98e49169a40876bcf1df832de6e908d1b350193 (diff)
parentfeda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff)
Update upstream source from tag 'upstream/3.2.1+dfsg1'
Update to upstream version '3.2.1+dfsg1' with Debian dir 5ea0333565de4dc898c062cc0ff4ba1153e2c1e4
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp b/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
index 96f73d7..0ef924d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
@@ -23,6 +23,7 @@
#include "parser/ast/sqlitesavepoint.h"
#include "parser/ast/sqliteupdate.h"
#include "parser/ast/sqlitevacuum.h"
+#include "parser/ast/sqliteupsert.h"
#include "services/pluginmanager.h"
#include "plugins/dbplugin.h"
#include "services/dbmanager.h"
@@ -207,7 +208,8 @@ SqliteQueryPtr DbVersionConverter::convert3To2(SqliteQueryPtr query)
if (!modifyDeleteForVersion2(newQuery.dynamicCast<SqliteDelete>().data()))
{
newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
+ if (diffsForNonDDL)
+ storeErrorDiff(query.data());
}
break;
case SqliteQueryType::Detach:
@@ -230,7 +232,8 @@ SqliteQueryPtr DbVersionConverter::convert3To2(SqliteQueryPtr query)
if (!modifyInsertForVersion2(newQuery.dynamicCast<SqliteInsert>().data()))
{
newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
+ if (diffsForNonDDL)
+ storeErrorDiff(query.data());
}
break;
case SqliteQueryType::Pragma:
@@ -260,7 +263,8 @@ SqliteQueryPtr DbVersionConverter::convert3To2(SqliteQueryPtr query)
if (!modifySelectForVersion2(newQuery.dynamicCast<SqliteSelect>().data()))
{
newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
+ if (diffsForNonDDL)
+ storeErrorDiff(query.data());
}
break;
}
@@ -269,7 +273,8 @@ SqliteQueryPtr DbVersionConverter::convert3To2(SqliteQueryPtr query)
if (!modifyUpdateForVersion2(newQuery.dynamicCast<SqliteUpdate>().data()))
{
newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
+ if (diffsForNonDDL)
+ storeErrorDiff(query.data());
}
break;
case SqliteQueryType::Vacuum:
@@ -450,7 +455,9 @@ bool DbVersionConverter::modifySelectForVersion2(SqliteSelect* select)
if (!modifyAllExprsForVersion2(select))
return false;
- storeDiff(sql1, select);
+ if (diffsForNonDDL)
+ storeDiff(sql1, select);
+
return true;
}
@@ -471,7 +478,9 @@ bool DbVersionConverter::modifyDeleteForVersion2(SqliteDelete* del)
if (!modifyAllExprsForVersion2(del))
return false;
- storeDiff(sql1, del);
+ if (diffsForNonDDL)
+ storeDiff(sql1, del);
+
return true;
}
@@ -497,6 +506,9 @@ bool DbVersionConverter::modifyInsertForVersion2(SqliteInsert* insert)
QString sql1 = getSqlForDiff(insert);
+ if (insert->upsert)
+ safe_delete(insert->upsert);
+
// Modifying SELECT deals with "VALUES" completely.
if (!modifySelectForVersion2(insert->select))
return false;
@@ -504,7 +516,9 @@ bool DbVersionConverter::modifyInsertForVersion2(SqliteInsert* insert)
if (!modifyAllExprsForVersion2(insert))
return false;
- storeDiff(sql1, insert);
+ if (diffsForNonDDL)
+ storeDiff(sql1, insert);
+
return true;
}
@@ -525,7 +539,9 @@ bool DbVersionConverter::modifyUpdateForVersion2(SqliteUpdate* update)
update->indexedByKw = false;
update->notIndexedKw = false;
- storeDiff(sql1, update);
+ if (diffsForNonDDL)
+ storeDiff(sql1, update);
+
return true;
}