diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-20 03:46:01 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-20 03:46:01 (GMT) |
commit | bb10e8d5570865b6fb1c4c7460600f92ea9f9844 (patch) | |
tree | c92420e5d6e48113dc61cadfd6d70ea99042db50 /examples | |
parent | 6dfbe4f4c57985c0767d152fd056ee5aad326d55 (diff) | |
parent | 3f7d4b985847d49cb47b666535218f2b9b08e0a5 (diff) | |
download | Qt-bb10e8d5570865b6fb1c4c7460600f92ea9f9844.zip Qt-bb10e8d5570865b6fb1c4c7460600f92ea9f9844.tar.gz Qt-bb10e8d5570865b6fb1c4c7460600f92ea9f9844.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/sql/hello.qml | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/examples/declarative/sql/hello.qml b/examples/declarative/sql/hello.qml index db568a9..20ea611 100644 --- a/examples/declarative/sql/hello.qml +++ b/examples/declarative/sql/hello.qml @@ -2,28 +2,36 @@ import Qt 4.6 Text { Script { - function allGreetings() - { + function findGreetings() { var db = openDatabase("QmlExampleDB", "", "The Example QML SQL!", 1000000); - var r = "" - db.transaction(function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)', []); - tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); - tx.executeSql('SELECT * FROM Greeting', [], - function(tx, rs) { - for(var i = 0; i < rs.rows.length; i++) { - r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n" + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)', []); + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + tx.executeSql('SELECT * FROM Greeting', [], + function(tx, rs) { + var r = "" + for(var i = 0; i < rs.rows.length; i++) { + r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n" + } + text = r + }, + function(tx, error) { + print("ERROR:", error.message) } - }, - function(tx, error) { - print("ERROR:", error.message) - } - ); - }) - - return r + ); + }, + function() { + print("ERROR in transaction"); + }, + function() { + print("Transaction successful"); + } + ) } } - text: allGreetings() + text: "?" + Component.onCompleted: findGreetings() } + |