@@ -60,6 +60,22 @@ void TestTable::notnull()
6060 " );" ));
6161}
6262
63+ void TestTable::withoutRowid ()
64+ {
65+ Table tt (" testtable" );
66+ FieldPtr f = FieldPtr (new Field (" a" , " integer" ));
67+ f->setPrimaryKey (true );
68+ f->setAutoIncrement (true );
69+ tt.addField (f);
70+ tt.addField (FieldPtr (new Field (" b" , " integer" )));
71+ tt.setRowidColumn (" a" );
72+
73+ QCOMPARE (tt.sql (), QString (" CREATE TABLE `testtable` (\n "
74+ " \t `a`\t integer PRIMARY KEY AUTOINCREMENT,\n "
75+ " \t `b`\t integer\n "
76+ " ) WITHOUT ROWID;" ));
77+ }
78+
6379void TestTable::parseSQL ()
6480{
6581 QString sSQL = " create TABLE hero (\n "
@@ -71,6 +87,7 @@ void TestTable::parseSQL()
7187 Table tab = Table::parseSQL (sSQL );
7288
7389 QVERIFY (tab.name () == " hero" );
90+ QVERIFY (tab.rowidColumn () == " rowid" );
7491 QVERIFY (tab.fields ().at (0 )->name () == " id" );
7592 QVERIFY (tab.fields ().at (1 )->name () == " name" );
7693 QVERIFY (tab.fields ().at (2 )->name () == " info" );
@@ -85,8 +102,6 @@ void TestTable::parseSQL()
85102 QCOMPARE (tab.fields ().at (1 )->defaultValue (), QString (" 'xxxx'" ));
86103 QCOMPARE (tab.fields ().at (1 )->check (), QString (" " ));
87104 QCOMPARE (tab.fields ().at (2 )->check (), QString (" info=='x'" ));
88-
89-
90105}
91106
92107void TestTable::parseSQLdefaultexpr ()
@@ -170,6 +185,16 @@ void TestTable::parseSQLKeywordInIdentifier()
170185 QVERIFY (tab.fields ().at (1 )->name () == " if" );
171186}
172187
188+ void TestTable::parseSQLWithoutRowid ()
189+ {
190+ QString sSQL = " CREATE TABLE test(a integer primary key, b integer) WITHOUT ROWID;" ;
191+
192+ Table tab = Table::parseSQL (sSQL );
193+
194+ QVERIFY (tab.fields ().at (tab.findPk ())->name () == " a" );
195+ QVERIFY (tab.rowidColumn () == " a" );
196+ }
197+
173198void TestTable::parseNonASCIIChars ()
174199{
175200 QString sSQL = " CREATE TABLE `lösung` ("
0 commit comments