Sqlite: Fix strict table

Change-Id: I1650e99ef24c236b2d630649f1a728de9d020190
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marco Bubke
2022-07-21 13:22:39 +02:00
parent 981ebfe488
commit 5fb450fd02
4 changed files with 10 additions and 6 deletions

View File

@@ -323,11 +323,15 @@ private:
void bindWithoutRowId() const
{
if (m_useWithoutRowId)
if (m_useWithoutRowId) {
if constexpr (std::is_same_v<ColumnType, ::Sqlite::ColumnType>)
m_sqlStatementBuilder.bind("$withoutRowId", " WITHOUT ROWID");
else
m_sqlStatementBuilder.bind("$withoutRowId", " WITHOUT ROWID,");
} else {
m_sqlStatementBuilder.bindEmptyText("$withoutRowId");
}
}
void bindIfNotExists() const
{

View File

@@ -103,7 +103,7 @@ public:
}
Column &addForeignKeyColumn(Utils::SmallStringView name,
const Column &referencedColumn,
const BasicColumn<ColumnType> &referencedColumn,
ForeignKeyAction foreignKeyupdateAction = {},
ForeignKeyAction foreignKeyDeleteAction = {},
Enforment foreignKeyEnforcement = {},

View File

@@ -690,7 +690,7 @@ TEST_F(CreateStrictTableSqlStatementBuilder, SetWitoutRowId)
ASSERT_THAT(
builder.sqlStatement(),
"CREATE TABLE test(id INTEGER PRIMARY KEY, name TEXT, number ANY) WITHOUT ROWID STRICT");
"CREATE TABLE test(id INTEGER PRIMARY KEY, name TEXT, number ANY) WITHOUT ROWID, STRICT");
}
TEST_F(CreateStrictTableSqlStatementBuilder, SetColumnDefinitions)

View File

@@ -386,7 +386,7 @@ TEST_F(StrictSqliteTable, InitializeTable)
EXPECT_CALL(databaseMock,
execute(Eq("CREATE TEMPORARY TABLE IF NOT EXISTS testTable(name ANY, value ANY) "
"WITHOUT ROWID STRICT")));
"WITHOUT ROWID, STRICT")));
table.initialize(databaseMock);
}