diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-18 03:02:52 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-18 03:02:52 (GMT) |
commit | 178d8c9cb87c5578e5175b5a405d470919644c4d (patch) | |
tree | e04fb8e083b266032ac5c6da37637ccff862a9fd /demos/declarative | |
parent | 6329879b47afad504eab2e629d15404bf7224cfb (diff) | |
download | Qt-178d8c9cb87c5578e5175b5a405d470919644c4d.zip Qt-178d8c9cb87c5578e5175b5a405d470919644c4d.tar.gz Qt-178d8c9cb87c5578e5175b5a405d470919644c4d.tar.bz2 |
Update examples for new SQL API.
Diffstat (limited to 'demos/declarative')
-rwxr-xr-x | demos/declarative/samegame/content/samegame.js | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js index 4d5a6be..3598c26 100755 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/content/samegame.js @@ -210,34 +210,22 @@ function saveHighScore(name) { if(scoresURL!="") sendHighScore(name); //OfflineStorage - var db = openDatabase("SameGameScores", "1.0", "Local SameGame High Scores",100); + var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; var data = [name, gameCanvas.score, maxX+"x"+maxY ,Math.floor(timer/1000)]; db.transaction( function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)',[]); + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); tx.executeSql(dataStr, data); - tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10',[], - function(tx, rs) { - var r = "\nHIGH SCORES for a standard sized grid\n\n" - for(var i = 0; i < rs.rows.length; i++){ - r += (i+1)+". " + rs.rows.item(i).name +' got ' - + rs.rows.item(i).score + ' points in ' - + rs.rows.item(i).time + ' seconds.\n'; - } - dialog.show(r); - }, - function(tx, error) { - print("ERROR:", error.message); - } - ); - }, - function() { - print("ERROR in transaction"); - }, - function() { - //print("Transaction successful"); + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10'); + var r = "\nHIGH SCORES for a standard sized grid\n\n" + for(var i = 0; i < rs.rows.length; i++){ + r += (i+1)+". " + rs.rows.item(i).name +' got ' + + rs.rows.item(i).score + ' points in ' + + rs.rows.item(i).time + ' seconds.\n'; + } + dialog.show(r); } ); } |