summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Hoelz <rob@hoelz.ro>2014-04-22 00:19:50 -0500
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-29 04:33:45 +0200
commit26e713cddcc8a62e49ce7a3352d3b5f13ffd7d52 (patch)
tree0a603f281661488a5e3a643dba98f79c7bb24c54
parent4b7a0a071728233b1dbb89d59a8253a32c020007 (diff)
Don't add the database before verificationv5.3.1stable
The local storage facility exposed to QML has a bug; if you attempt to open a versioned connection, the version is wrong, and you try to handle that error, the connection is still stored in a connection pool, but in an unopened state. The next time you attempt to connect, no matter if you have the version right or not, the database handle will complain about being unopened. See also http://qt-project.org/forums/viewthread/38458/ Task-number: QTBUG-38543 Change-Id: I597497aab4895c868275a247ad96fb969e1c8ae5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/declarative/qml/qdeclarativesqldatabase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp
index 4b9e43e1..58e874f1 100644
--- a/src/declarative/qml/qdeclarativesqldatabase.cpp
+++ b/src/declarative/qml/qdeclarativesqldatabase.cpp
@@ -386,7 +386,6 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
THROW_SQL(VERSION_ERR,QDeclarativeEngine::tr("SQL: database version mismatch"));
} else {
created = !QFile::exists(basename+QLatin1String(".sqlite"));
- database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid);
if (created) {
ini.setValue(QLatin1String("Name"), dbname);
if (dbcreationCallback.isFunction())
@@ -402,6 +401,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng
}
version = ini.value(QLatin1String("Version")).toString();
}
+ database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid);
database.setDatabaseName(basename+QLatin1String(".sqlite"));
}
if (!database.isOpen())