forked from qt-creator/qt-creator
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:
@@ -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
|
||||
{
|
||||
|
@@ -103,7 +103,7 @@ public:
|
||||
}
|
||||
|
||||
Column &addForeignKeyColumn(Utils::SmallStringView name,
|
||||
const Column &referencedColumn,
|
||||
const BasicColumn<ColumnType> &referencedColumn,
|
||||
ForeignKeyAction foreignKeyupdateAction = {},
|
||||
ForeignKeyAction foreignKeyDeleteAction = {},
|
||||
Enforment foreignKeyEnforcement = {},
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user