summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers/sqlite/qsql_sqlite.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-13 15:33:42 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-13 15:33:42 (GMT)
commit42dda19d82ceea48f19d356cfaf2b26acb763df8 (patch)
treed2c7f2c9de464b1908316b94c07cc8ece831ad00 /src/sql/drivers/sqlite/qsql_sqlite.cpp
parent6944a72cd26a5e3611ebd305ec665bc4c0fcee12 (diff)
parentdcb2678f39345b66c5303e74c156654a8d13fe83 (diff)
downloadQt-42dda19d82ceea48f19d356cfaf2b26acb763df8.zip
Qt-42dda19d82ceea48f19d356cfaf2b26acb763df8.tar.gz
Qt-42dda19d82ceea48f19d356cfaf2b26acb763df8.tar.bz2
Merge branch 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (85 commits) Add make stub_sis target, and add webkit stub to qt.iby Fix to S60 softkeys when no active Qt window or native widget is shown. doc: Fixed several typos. Doc: remove \preliminary tag from public multimedia classes Fixed the perl download link and description in docs Revert WebCore.pro part of 2761e6f57ecd00c3435dbb8a6cf5f40653195d5d to build QtWebKit with THUMB again QNAM HTTP: Optimize detectPipeliningSupport() QNAM HTTP: Set channel to IdleState at better place QXmlSchema: fix crash in schema parser We need to export qBadAlloc() on all platforms now really fix the message editor for dark backgrounds Revert "(ODBC) Use wchar_t instead of assuming 2 bytes." Update Symbian DEF files Export a function to get dfb-surface from a pixmap Fix the WebKit build Blinking cursors are 2 pixels wide on Mac OS X/Cocoa. Fixed compilation with QT_NO_WHEELEVENT Fixed usage of QGLPixelBuffer with share widgets on other X11 screens. Fixed drawing QPixmaps on QGLWidgets on different X11 screens. Take into account the solaris-cc-64-stlport mkspec ...
Diffstat (limited to 'src/sql/drivers/sqlite/qsql_sqlite.cpp')
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp47
1 files changed, 19 insertions, 28 deletions
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 9fff552..d3be304 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -500,32 +500,6 @@ bool QSQLiteDriver::hasFeature(DriverFeature f) const
return false;
}
-static int qGetSqliteTimeout(QString opts)
-{
- enum { DefaultTimeout = 5000 };
-
- opts.remove(QLatin1Char(' '));
- foreach(QString option, opts.split(QLatin1Char(';'))) {
- if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
- bool ok;
- int nt = option.mid(21).toInt(&ok);
- if (ok)
- return nt;
- }
- }
- return DefaultTimeout;
-}
-
-static int qGetSqliteOpenMode(QString opts)
-{
- opts.remove(QLatin1Char(' '));
- foreach(QString option, opts.split(QLatin1Char(';'))) {
- if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
- return SQLITE_OPEN_READONLY;
- }
- return SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
-}
-
/*
SQLite dbs have no user name, passwords, hosts or ports.
just file names.
@@ -537,9 +511,26 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
if (db.isEmpty())
return false;
+ bool sharedCache = false;
+ int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000;
+ QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';'));
+ foreach(const QString &option, opts) {
+ if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
+ bool ok;
+ int nt = option.mid(21).toInt(&ok);
+ if (ok)
+ timeOut = nt;
+ }
+ if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
+ openMode = SQLITE_OPEN_READONLY;
+ if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE"))
+ sharedCache = true;
+ }
+
+ sqlite3_enable_shared_cache(sharedCache);
- if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, qGetSqliteOpenMode(conOpts), NULL) == SQLITE_OK) {
- sqlite3_busy_timeout(d->access, qGetSqliteTimeout(conOpts));
+ if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) {
+ sqlite3_busy_timeout(d->access, timeOut);
setOpen(true);
setOpenError(false);
return true;