tests/auto/declarative/qdeclarativesqldatabase/data/selection-bindnames.js
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     1 function test() {
       
     2     var db = openDatabaseSync("QmlTestDB-bindnames", "", "Test database from Qt autotests", 1000000);
       
     3     var r="transaction_not_finished";
       
     4 
       
     5     db.transaction(
       
     6         function(tx) {
       
     7             tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
       
     8             tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
       
     9             tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'goodbye', 'world' ]);
       
    10             tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
       
    11             tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'there' ]);
       
    12         }
       
    13     );
       
    14 
       
    15     db.transaction(
       
    16         function(tx) {
       
    17             var rs = tx.executeSql('SELECT * FROM Greeting WHERE salutation=:p2 AND salutee=:p1', {':p1':'world', ':p2':'hello'});
       
    18             if ( rs.rows.length != 2 )
       
    19                 r = "SELECT RETURNED WRONG VALUE "+rs.rows.length+rs.rows.item(0)+rs.rows.item(1)
       
    20             else
       
    21                 r = "passed";
       
    22         }
       
    23     );
       
    24 
       
    25     return r;
       
    26 }