Simplify the WITHOUT ROWID code a bit

In the Table class we need to store whether this is a WITHOUT ROWID
table or now. Instead of just storing a boolean flag for that we were
storing a list of the rowid column(s). This is not just more complicated
to handle than a simple flag but also more error-prone because the list
must always be kept equal to the list of primary key columns. Failing to
keep them equal would result in an invalid SQL statement.
This commit is contained in:
Martin Kleusberg
2019-04-03 12:08:58 +02:00
parent 25715bb590
commit fcac61da64
6 changed files with 28 additions and 19 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ void TestTable::withoutRowid()
f.setAutoIncrement(true);
tt.fields.push_back(f);
tt.fields.emplace_back("b", "integer");
tt.setRowidColumns({"a"});
tt.setWithoutRowidTable(true);
tt.addConstraint({f.name()}, ConstraintPtr(new PrimaryKeyConstraint()));
QCOMPARE(tt.sql(), QString("CREATE TABLE \"testtable\" (\n"