diff options
author | Bill King <bill.king@nokia.com> | 2010-02-09 03:14:50 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2010-02-09 03:14:50 (GMT) |
commit | 72f3caa5d7821b93a4e807fb61c5cda9f2c6f393 (patch) | |
tree | 62d6612926f7bbcce8a1a28cbdb1a382339aa566 /tests | |
parent | ff222b3ece43664a4f599c8a6b0275d2aa72cc4d (diff) | |
download | Qt-72f3caa5d7821b93a4e807fb61c5cda9f2c6f393.zip Qt-72f3caa5d7821b93a4e807fb61c5cda9f2c6f393.tar.gz Qt-72f3caa5d7821b93a4e807fb61c5cda9f2c6f393.tar.bz2 |
(sqlite) Allow shared cache mode
This modification is needed to allow performance optimisations
necessary for QML.
Reviewed-by: Warwick Allison
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 5b61da2..fe084fa 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -202,6 +202,8 @@ private slots: void sqlStatementUseIsNull_189093_data() { generic_data(); } void sqlStatementUseIsNull_189093(); + void sqlite_enable_cache_mode_data() { generic_data("QSQLITE"); } + void sqlite_enable_cache_mode(); private: void createTestTables(QSqlDatabase db); @@ -2485,5 +2487,23 @@ void tst_QSqlDatabase::oci_tables() QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper())); } +void tst_QSqlDatabase::sqlite_enable_cache_mode() +{ + QFETCH(QString, dbName); + if(dbName.endsWith(":memory:")) + QSKIP( "cache mode is meaningless for :memory: databases", SkipSingle ); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + db.close(); + db.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE"); + QVERIFY_SQL(db, open()); + QSqlDatabase db2 = QSqlDatabase::cloneDatabase(db, dbName+":cachemodeconn2"); + db2.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE"); + QVERIFY_SQL(db2, open()); + QSqlQuery q(db), q2(db2); + QVERIFY_SQL(q, exec("select * from "+qTableName("qtest"))); + QVERIFY_SQL(q2, exec("select * from "+qTableName("qtest"))); +} + QTEST_MAIN(tst_QSqlDatabase) #include "tst_qsqldatabase.moc" |