From 1b6bccf66f493844d940a9ea3353aa3ee308fc3d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 20 Nov 2009 17:58:51 +1000 Subject: Check version for cached DB too. --- src/declarative/qml/qmlsqldatabase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 933eb92..d11e3cb 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -350,6 +350,8 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng if (QSqlDatabase::connectionNames().contains(dbid)) { database = QSqlDatabase::database(dbid); version = ini.value(QLatin1String("Version")).toString(); + if (version != dbversion && !dbversion.isEmpty() && !version.isEmpty()) + THROW_SQL(VERSION_ERR,QmlEngine::tr("SQL: database version mismatch")); } else { created = !QFile::exists(basename+QLatin1String(".sqlite")); database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid); -- cgit v0.12