Skip to content

Commit 57a3e6e

Browse files
authored
Merge pull request #4079 from mdmahendri/fix-virtual-export
Fix virtual table sql file export typo
2 parents 1614051 + 78c11a2 commit 57a3e6e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/sqlitedb.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,9 +913,14 @@ bool DBBrowserDB::dump(const QString& filePath,
913913
else {
914914
QString statement = QString::fromStdString(it->originalSql());
915915
if(keepOldSchema) {
916-
// The statement is guaranteed by SQLite to start with "CREATE TABLE"
917-
const int createTableLength = 12;
918-
statement.replace(0, createTableLength, "CREATE TABLE IF NOT EXISTS");
916+
if (statement.startsWith("CREATE VIRTUAL TABLE", Qt::CaseInsensitive)) {
917+
const int createTableLength = 20;
918+
statement.replace(0, createTableLength, "CREATE VIRTUAL TABLE IF NOT EXISTS");
919+
} else {
920+
// The statement is guaranteed by SQLite to start with "CREATE TABLE"
921+
const int createTableLength = 12;
922+
statement.replace(0, createTableLength, "CREATE TABLE IF NOT EXISTS");
923+
}
919924
}
920925
stream << statement << ";\n";
921926
}

0 commit comments

Comments
 (0)