aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlExport/sqlexport.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2015-04-04 14:41:04 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2015-04-04 14:41:04 -0400
commita5b034d4a9c44f9bc1e83b01de82530f8fc63013 (patch)
tree7a358206c4aff9c33df1752c92eafec97cee2244 /Plugins/SqlExport/sqlexport.cpp
parent306d6d3ca9c9ad774d19135681a7f9805f77035f (diff)
Imported Upstream version 3.0.4upstream/3.0.4
Diffstat (limited to 'Plugins/SqlExport/sqlexport.cpp')
-rw-r--r--Plugins/SqlExport/sqlexport.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Plugins/SqlExport/sqlexport.cpp b/Plugins/SqlExport/sqlexport.cpp
index 0a379b1..15e47ed 100644
--- a/Plugins/SqlExport/sqlexport.cpp
+++ b/Plugins/SqlExport/sqlexport.cpp
@@ -145,6 +145,7 @@ bool SqlExport::exportTableRow(SqlResultsRowPtr data)
bool SqlExport::afterExport()
{
writeCommit();
+ writeFkEnable();
return true;
}
@@ -237,12 +238,20 @@ void SqlExport::writeFkDisable()
writeln("PRAGMA foreign_keys = off;");
}
+void SqlExport::writeFkEnable()
+{
+ writeln("PRAGMA foreign_keys = on;");
+}
+
QString SqlExport::formatQuery(const QString& sql)
{
if (cfg.SqlExport.UseFormatter.get())
return FORMATTER->format("sql", sql, db);
- return sql;
+ if (sql.trimmed().endsWith(";"))
+ return sql;
+
+ return sql.trimmed() + ";";
}
QString SqlExport::getNameForObject(const QString& database, const QString& name, bool wrapped, Dialect dialect)