diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-12-04 04:48:11 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-12-04 04:48:11 (GMT) |
commit | 69d4e0a18f6efaf3d7660e4b708b9fcdb9a64250 (patch) | |
tree | 69ea498fc04c6a81d61b984d32bb060b410ec553 /src/declarative | |
parent | 6b35bde56028997a9a676f5135f0525575937dba (diff) | |
download | Qt-69d4e0a18f6efaf3d7660e4b708b9fcdb9a64250.zip Qt-69d4e0a18f6efaf3d7660e4b708b9fcdb9a64250.tar.gz Qt-69d4e0a18f6efaf3d7660e4b708b9fcdb9a64250.tar.bz2 |
Prevent call to executeSql outside transaction (eg. if arg kept).
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qmlsqldatabase.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 3ddfec3..d0d8264 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -196,6 +196,12 @@ static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine * return engine->undefinedValue(); } +static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine *engine) +{ + qDebug() << QmlEngine::tr("executeSql called outside transaction()"); + THROW_SQL(DATABASE_ERR,QmlEngine::tr("executeSql called outside transaction()")); +} + static QScriptValue qmlsqldatabase_executeSql(QScriptContext *context, QScriptEngine *engine) { QSqlDatabase db = qscriptvalue_cast<QSqlDatabase>(context->thisObject()); @@ -308,6 +314,8 @@ static QScriptValue qmlsqldatabase_transaction_shared(QScriptContext *context, Q db.transaction(); callback.call(QScriptValue(), QScriptValueList() << tx); + instance.setProperty(QLatin1String("executeSql"), + engine->newFunction(qmlsqldatabase_executeSql_outsidetransaction)); if (engine->hasUncaughtException()) { db.rollback(); } else { |