Debian Codegraph @

tests/auto/qml/qqmlsqldatabase/data/selection-bindnames.js

raw symbols SCIP
1 .import QtQuick.LocalStorage 2.0 as Sql
2
3 function test() {
4 var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-bindnames", "", "Test database from Qt autotests", 1000000);
5 var r="transaction_not_finished";
6
7 db.transaction(
8 function(tx) {
9 tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
10 tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
11 tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'goodbye', 'world' ]);
12 tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
13 tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'there' ]);
14 }
15 );
16
17 db.transaction(
18 function(tx) {
19 var rs = tx.executeSql('SELECT * FROM Greeting WHERE salutation=:p2 AND salutee=:p1', {':p1':'world', ':p2':'hello'});
20 if ( rs.rows.length != 2 )
21 r = "SELECT RETURNED WRONG VALUE "+rs.rows.length+rs.rows.item(0)+rs.rows.item(1)
22 else
23 r = "passed";
24 }
25 );
26
27 return r;
28 }