diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-22 05:34:41 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-22 05:36:35 (GMT) |
commit | 888d29c9c138ca3d698985f090ceb3db912ade0f (patch) | |
tree | aa991f683dd8e7ea4b05d029dd75b32321fde3c0 /examples/declarative/sql | |
parent | 42de973ff156383beed62a6b1bce70b56b360078 (diff) | |
download | Qt-888d29c9c138ca3d698985f090ceb3db912ade0f.zip Qt-888d29c9c138ca3d698985f090ceb3db912ade0f.tar.gz Qt-888d29c9c138ca3d698985f090ceb3db912ade0f.tar.bz2 |
Deprecate inline Script {} blocks
Inline blocks/includes have been replaced with an import syntax:
import "foo.js" as Foo
this gives better separation between QML and code. Imported script blocks
also have a mandatory qualifier, which leads to better optimization
potential.
Diffstat (limited to 'examples/declarative/sql')
-rw-r--r-- | examples/declarative/sql/hello.qml | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/examples/declarative/sql/hello.qml b/examples/declarative/sql/hello.qml index 277dfeb..29e084c 100644 --- a/examples/declarative/sql/hello.qml +++ b/examples/declarative/sql/hello.qml @@ -1,30 +1,29 @@ import Qt 4.6 Text { - Script { - function findGreetings() { - var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); + function findGreetings() { + var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); - db.transaction( - function(tx) { - // Create the database if it doesn't already exist - tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); + db.transaction( + function(tx) { + // Create the database if it doesn't already exist + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); - // Add (another) greeting row - tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + // Add (another) greeting row + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); - // Show all added greetings - var rs = tx.executeSql('SELECT * FROM Greeting'); + // Show all added greetings + var rs = tx.executeSql('SELECT * FROM Greeting'); - 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 + 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 + } + ) } + text: "?" Component.onCompleted: findGreetings() } |