From 9de879c8a43a012254036d7f08b55793fa325cb2 Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Thu, 28 Nov 2013 00:06:41 +0100 Subject: [PATCH] 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 Reviewed-by: Mark Brand --- src/sql/doc/src/sql-driver.qdoc | 4 ++-- src/sql/drivers/sqlite/qsql_sqlite.cpp | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index d8d10582f63..82dfa27e46f 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -599,8 +599,8 @@ is not necessary to have a database server. SQLite operates on a single file, which must be set as the database name when opening a connection. If the file does not exist, SQLite will try to - create it. SQLite also supports in-memory databases, simply pass - ":memory:" as the database name. + create it. SQLite also supports in-memory and temporary databases. Simply + pass respectively ":memory:" or an empty string as the database name. SQLite has some restrictions regarding multiple users and multiple transactions. If you try to read/write on a resource from different diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 0a8b71aa8a8..7530569563e 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -582,8 +582,6 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c if (isOpen()) close(); - 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(';'));