summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqldatabase
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qsqldatabase')
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp20
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"