mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-04-26 06:28:24 -05:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user