i'm trying use cordova-sqlite-storage
in phonegap
application
i have included sqliteplugin.js
in application page, when execute documentation demo code, returning error message in console:
[console.log] open database: database [console.log] new transaction waiting open operation [console.log] open database: database failed. aborting pending transactions [console.log] not open database
this code executed:
// wait cordova load document.addeventlistener("deviceready", ondeviceready, false); // cordova ready function ondeviceready() { var db = window.sqliteplugin.opendatabase("database", "1.0", "demo", -1); db.transaction(function(tx) { tx.executesql('drop table if exists test_table'); tx.executesql('create table if not exists test_table (id integer primary key, data text, data_num integer)'); tx.executesql("insert test_table (data, data_num) values (?,?)", ["test", 100], function(tx, res) { console.log("insertid: " + res.insertid + " -- 1"); console.log("rowsaffected: " + res.rowsaffected + " -- should 1"); tx.executesql("select count(id) cnt test_table;", [], function(tx, res) { console.log("res.rows.length: " + res.rows.length + " -- should 1"); console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should 1"); }); }, function(e) { console.log("error: " + e.message); }); }); }
in documentation write:
install sqliteandroiddatabase.java , sqliteplugin.java src/android/io/liteglue src/io/liteglue subdirectory
but can't find src
folder in project
are trying run in browser?
in device work in browser wont't!!