summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlsqldatabase.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-12-04 09:15:13 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-12-04 09:15:13 (GMT)
commitf3a55136c0375d358e93929e94c2ab6c15dbfb93 (patch)
treeda684dbcf6df7fad4d0badbda42eec5053dbc3c7 /src/declarative/qml/qmlsqldatabase.cpp
parent23708b0676ed4db10aca81eb2eb1e043fef21328 (diff)
downloadQt-f3a55136c0375d358e93929e94c2ab6c15dbfb93.zip
Qt-f3a55136c0375d358e93929e94c2ab6c15dbfb93.tar.gz
Qt-f3a55136c0375d358e93929e94c2ab6c15dbfb93.tar.bz2
Make QmlScriptEngine reusable in WorkScript, so extra fns are available.
Add Qt.resolvedUrl(url)
Diffstat (limited to 'src/declarative/qml/qmlsqldatabase.cpp')
-rw-r--r--src/declarative/qml/qmlsqldatabase.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp
index b550f96..e82c54e 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qmlsqldatabase.cpp
@@ -173,7 +173,8 @@ static const char* sqlerror[] = {
static QString databaseFile(const QString& connectionName, QScriptEngine *engine)
{
- QString basename = QmlEnginePrivate::get(engine)->offlineStoragePath
+ QmlScriptEngine *qmlengine = static_cast<QmlScriptEngine*>(engine);
+ QString basename = qmlengine->offlineStoragePath
+ QDir::separator() + QLatin1String("Databases") + QDir::separator();
basename += connectionName;
return basename;
@@ -198,6 +199,7 @@ static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *
static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine *engine)
{
+ qDebug() << QmlEngine::tr("executeSql called outside transaction()"); // XXX pending bug QTBUG-6507
THROW_SQL(DATABASE_ERR,QmlEngine::tr("executeSql called outside transaction()"));
}
@@ -224,9 +226,10 @@ static QScriptValue qmlsqldatabase_executeSql(QScriptContext *context, QScriptEn
}
if (query.exec()) {
result = engine->newObject();
- if (!QmlEnginePrivate::get(engine)->sqlQueryClass)
- QmlEnginePrivate::get(engine)->sqlQueryClass= new QmlSqlQueryScriptClass(engine);
- QScriptValue rows = engine->newObject(QmlEnginePrivate::get(engine)->sqlQueryClass);
+ QmlScriptEngine *qmlengine = static_cast<QmlScriptEngine*>(engine);
+ if (!qmlengine->sqlQueryClass)
+ qmlengine->sqlQueryClass = new QmlSqlQueryScriptClass(engine);
+ QScriptValue rows = engine->newObject(qmlengine->sqlQueryClass);
rows.setData(engine->newVariant(qVariantFromValue(query)));
rows.setProperty(QLatin1String("item"), engine->newFunction(qmlsqldatabase_item,1), QScriptValue::SkipInEnumeration);
result.setProperty(QLatin1String("rows"),rows);
@@ -406,6 +409,7 @@ void qt_add_qmlsqldatabase(QScriptEngine *engine)
{
QScriptValue openDatabase = engine->newFunction(qmlsqldatabase_open_sync, 4);
engine->globalObject().setProperty(QLatin1String("openDatabaseSync"), openDatabase);
+qDebug() << "qt_add_qmlsqldatabase" << engine;
QScriptValue sqlExceptionPrototype = engine->newObject();
for (int i=0; sqlerror[i]; ++i)