lundi 16 mars 2015

Websql can't read the .sqlite file?

I am using deskshell to create a standalone application, for which i also need a database. At the moment i am testing with Web SQL


In deskshell i created a folder data in htdocs with visitors.sqlite and visitors.sql (don't know which will work) Als i edit test.desk by



"port": 8115,


so deskshell will use the same port each time.


In index.htm i have



var db = openDatabase('visitors.sqlite', '1.0', 'Test DB', 2 * 1024 * 1024);
//var db = openDatabase('visitors.sql', '1.0', 'Test DB', 2 * 1024 * 1024);
var msg;
console.log(db);
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM visitors_tbl', [], function (tx, results) {
var len = results.rows.length, i;
msg = "<p>Found rows: " + len + "</p>";
document.querySelector('#status').innerHTML += msg;
alert("Msg "+msg);
for (i = 0; i < len; i++){
msg = "<p><b>" + results.rows.item(i).word + "</b></p>";
document.querySelector('#status').innerHTML += msg;
}
}, null);
});


When i look into the console resources i can't see the table visitors_tbl? even if i use



var db = openDatabase('visitors.sql', '1.0', 'Test DB', 2 * 1024 * 1024);


Which includes a create table query.


Any tips


Aucun commentaire:

Enregistrer un commentaire