Allow temporary databases in sqlite driver

http://www3.sqlite.org/inmemorydb.html#temp_db
[ChangeLog][QtSql][QSQLITE] Enable creating temporary databases

Change-Id: I9972fba5c91eca55cfc5a84f94cff03d19992324
Reviewed-by: Tobias Koenig <tobias.koenig.qnx@kdab.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
Nicolas Cornu 2013-11-28 00:06:41 +01:00 committed by The Qt Project
parent f3e220d4c2
commit 9de879c8a4
2 changed files with 2 additions and 4 deletions

View File

@ -599,8 +599,8 @@
is not necessary to have a database server. SQLite operates on a is not necessary to have a database server. SQLite operates on a
single file, which must be set as the database name when opening single file, which must be set as the database name when opening
a connection. If the file does not exist, SQLite will try to a connection. If the file does not exist, SQLite will try to
create it. SQLite also supports in-memory databases, simply pass create it. SQLite also supports in-memory and temporary databases. Simply
":memory:" as the database name. pass respectively ":memory:" or an empty string as the database name.
SQLite has some restrictions regarding multiple users and SQLite has some restrictions regarding multiple users and
multiple transactions. If you try to read/write on a resource from different multiple transactions. If you try to read/write on a resource from different

View File

@ -582,8 +582,6 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
if (isOpen()) if (isOpen())
close(); close();
if (db.isEmpty())
return false;
bool sharedCache = false; bool sharedCache = false;
int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000; int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000;
QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';'));