From a5b034d4a9c44f9bc1e83b01de82530f8fc63013 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 4 Apr 2015 14:41:04 -0400 Subject: Imported Upstream version 3.0.4 --- Plugins/SqlExport/SqlExport_de.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_es.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_fr.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_pl.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_pt_BR.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_ru.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_sk.ts | 14 +++++++------- Plugins/SqlExport/SqlExport_zh_CN.ts | 14 +++++++------- Plugins/SqlExport/sqlexport.cpp | 11 ++++++++++- Plugins/SqlExport/sqlexport.h | 1 + Plugins/SqlExport/sqlexport.json | 2 +- Plugins/SqlExport/sqlexport.qrc | 2 ++ 12 files changed, 70 insertions(+), 58 deletions(-) (limited to 'Plugins/SqlExport') diff --git a/Plugins/SqlExport/SqlExport_de.ts b/Plugins/SqlExport/SqlExport_de.ts index 9346fcd..5313de2 100644 --- a/Plugins/SqlExport/SqlExport_de.ts +++ b/Plugins/SqlExport/SqlExport_de.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ - + -- Index: %1 - + -- Trigger: %1 - + -- View: %1 - + -- File generated with SQLiteStudio v%1 on %2 - + -- Text encoding used: %1 - + Table name for INSERT statements is mandatory. diff --git a/Plugins/SqlExport/SqlExport_es.ts b/Plugins/SqlExport/SqlExport_es.ts index 87c95b0..2ff1ffa 100644 --- a/Plugins/SqlExport/SqlExport_es.ts +++ b/Plugins/SqlExport/SqlExport_es.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ - + -- Index: %1 - + -- Trigger: %1 - + -- View: %1 - + -- File generated with SQLiteStudio v%1 on %2 - + -- Text encoding used: %1 - + Table name for INSERT statements is mandatory. diff --git a/Plugins/SqlExport/SqlExport_fr.ts b/Plugins/SqlExport/SqlExport_fr.ts index 7ffe713..02c2cbc 100644 --- a/Plugins/SqlExport/SqlExport_fr.ts +++ b/Plugins/SqlExport/SqlExport_fr.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ -- Table: %1 - + -- Index: %1 -- Indéxe: %1 - + -- Trigger: %1 -- Déclencheur: %1 - + -- View: %1 -- Vue: %1 - + -- File generated with SQLiteStudio v%1 on %2 -- Fichier généré par SQLiteStudio v%1sur %2 - + -- Text encoding used: %1 -- Encodage texte utilisé: %1 - + Table name for INSERT statements is mandatory. Nom de table pour la déclaration INSERT est obligatoire. diff --git a/Plugins/SqlExport/SqlExport_pl.ts b/Plugins/SqlExport/SqlExport_pl.ts index 5fc187b..7c8a3f5 100644 --- a/Plugins/SqlExport/SqlExport_pl.ts +++ b/Plugins/SqlExport/SqlExport_pl.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ -- Tabela: %1 - + -- Index: %1 -- Indeks: %1 - + -- Trigger: %1 -- Wyzwalacz: %1 - + -- View: %1 -- Widok: %1 - + -- File generated with SQLiteStudio v%1 on %2 -- Plik wygenerowany przez SQLiteStudio v%1 dnia %2 - + -- Text encoding used: %1 -- Użyte kodowanie tekstu: %1 - + Table name for INSERT statements is mandatory. Nazwa tabeli dla zapytania INSERT jest obowiązkowa. diff --git a/Plugins/SqlExport/SqlExport_pt_BR.ts b/Plugins/SqlExport/SqlExport_pt_BR.ts index 803c9dc..a781f3a 100644 --- a/Plugins/SqlExport/SqlExport_pt_BR.ts +++ b/Plugins/SqlExport/SqlExport_pt_BR.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ - + -- Index: %1 - + -- Trigger: %1 - + -- View: %1 - + -- File generated with SQLiteStudio v%1 on %2 - + -- Text encoding used: %1 - + Table name for INSERT statements is mandatory. diff --git a/Plugins/SqlExport/SqlExport_ru.ts b/Plugins/SqlExport/SqlExport_ru.ts index 9b03eaf..b6b1cd8 100644 --- a/Plugins/SqlExport/SqlExport_ru.ts +++ b/Plugins/SqlExport/SqlExport_ru.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ -- Таблица: %1 - + -- Index: %1 -- Индекс: %1 - + -- Trigger: %1 -- Триггер: %1 - + -- View: %1 -- Представление: %1 - + -- File generated with SQLiteStudio v%1 on %2 -- Файл сгенерирован с помощью SQLiteStudio v%1 в %2 - + -- Text encoding used: %1 -- Использованная кодировка текста: %1 - + Table name for INSERT statements is mandatory. Имя таблицы для конструкций INSERT обязательно. diff --git a/Plugins/SqlExport/SqlExport_sk.ts b/Plugins/SqlExport/SqlExport_sk.ts index 6494355..ef6a4bc 100644 --- a/Plugins/SqlExport/SqlExport_sk.ts +++ b/Plugins/SqlExport/SqlExport_sk.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ - + -- Index: %1 - + -- Trigger: %1 - + -- View: %1 - + -- File generated with SQLiteStudio v%1 on %2 - + -- Text encoding used: %1 - + Table name for INSERT statements is mandatory. diff --git a/Plugins/SqlExport/SqlExport_zh_CN.ts b/Plugins/SqlExport/SqlExport_zh_CN.ts index 1d81d3f..d29cae8 100644 --- a/Plugins/SqlExport/SqlExport_zh_CN.ts +++ b/Plugins/SqlExport/SqlExport_zh_CN.ts @@ -1,6 +1,6 @@ - + SqlExport @@ -14,32 +14,32 @@ - + -- Index: %1 - + -- Trigger: %1 - + -- View: %1 - + -- File generated with SQLiteStudio v%1 on %2 - + -- Text encoding used: %1 - + Table name for INSERT statements is mandatory. 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) diff --git a/Plugins/SqlExport/sqlexport.h b/Plugins/SqlExport/sqlexport.h index 9e23418..56eb42d 100644 --- a/Plugins/SqlExport/sqlexport.h +++ b/Plugins/SqlExport/sqlexport.h @@ -53,6 +53,7 @@ class SQLEXPORTSHARED_EXPORT SqlExport : public GenericExportPlugin void writeBegin(); void writeCommit(); void writeFkDisable(); + void writeFkEnable(); QString formatQuery(const QString& sql); QString getNameForObject(const QString& database, const QString& name, bool wrapped, Dialect dialect = Dialect::Sqlite3); QStringList rowToArgList(SqlResultsRowPtr row); diff --git a/Plugins/SqlExport/sqlexport.json b/Plugins/SqlExport/sqlexport.json index bd06adf..82ad923 100644 --- a/Plugins/SqlExport/sqlexport.json +++ b/Plugins/SqlExport/sqlexport.json @@ -2,6 +2,6 @@ "type": "ExportPlugin", "title": "SQL export", "description": "Provides SQL format for exporting", - "version": 10100, + "version": 10101, "author": "SalSoft" } diff --git a/Plugins/SqlExport/sqlexport.qrc b/Plugins/SqlExport/sqlexport.qrc index ca38e9c..ed5da11 100644 --- a/Plugins/SqlExport/sqlexport.qrc +++ b/Plugins/SqlExport/sqlexport.qrc @@ -7,5 +7,7 @@ SqlExport_pl.qm SqlExport_ru.qm SqlExport_fr.qm + SqlExport_sk.qm + SqlExport_zh_CN.qm -- cgit v1.2.3