| 1 | .import QtQuick.LocalStorage 2.0 as Sql |
| 2 | |
| 3 | function test() { |
| 4 | var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-nullvalues", "", "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 NullValues(salutation TEXT, salutee TEXT)'); |
| 10 | tx.executeSql('INSERT INTO NullValues VALUES(?, ?)', [ 'hello', null ]); |
| 11 | var firstRow = tx.executeSql("SELECT * FROM NullValues").rows.item(0); |
| 12 | if (firstRow.salutation !== "hello") |
| 13 | return |
| 14 | if (firstRow.salutee === "") { |
| 15 | r = "wrong_data_type" |
| 16 | return |
| 17 | } |
| 18 | if (firstRow.salutee === null) |
| 19 | r = "passed"; |
| 20 | } |
| 21 | ); |
| 22 | |
| 23 | return r; |
| 24 | } |