diff options
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 { |