This is code for the onDeviceReady Handler
code
var db = window.openDatabase("Deep", "1.0", "Deep", 200000);
db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS "in_queue" (name TEXT)');
tx.executeSql('INSERT INTO "in_queue" (name) VALUES ("First row")');
}, function(err) {
alert("Error processing SQL: "+err.code);
}, function () {
alert("success DB!");
}
);
/code
this code is for listDB.js
code
var db = window.openDatabase("Deep", "1.0", "Deep", 200000);
$t.getTableList = $t.createClass(null, {
Code: Select all
init: function(requestOptions) {
this.__requestOptions = $.extend({}, requestOptions);
},
process: function(settings) {
if (this.__requestOptions.echo) {
settings.success(this.__requestOptions.echo);
} else {
var ourFinalArray = [];
db.transaction(function(tx) {
tx.executeSql('SELECT * FROM "in_queue"',[], function(tx, results) {
// console.log("getTableList call made");
var len = results.rows.length,i;
if (len == 0) {
//donothing
} else {
for (i = 0; i < len; i++) { // for each row
ourFinalArray.push(results.rows.item(i)); // pushing row object to an array
}
console.log("Tables: " + JSON.stringify(ourFinalArray));
settings.success(JSON.stringify(ourFinalArray));
}
settings.complete('success');
});
});
}
}
});
/code
When the last code is bind to the service - the application just freeze on load.
In debug mode i see that for listDB.js I see error 'window.openDatabase' is not a function.
Can you please help?
Thanks!
Mike