mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2024-11-25 18:12:16 -05:00
Added changes as per @chbrody pull 24 for Cordova
https://github.com/davibe/Phonegap-SQLitePlugin/pull/24 Added changes as per @chbrody
This commit is contained in:
parent
7428cd7384
commit
971a859f68
33
README.md
33
README.md
@ -79,22 +79,23 @@ General Usage
|
|||||||
|
|
||||||
## Plain Javascript
|
## Plain Javascript
|
||||||
|
|
||||||
var db;
|
var db;
|
||||||
db = new SQLitePlugin("test_native.sqlite3");
|
db = new SQLitePlugin("my_sqlite_database.sqlite3");
|
||||||
db.executeSql('DROP TABLE IF EXISTS test_table');
|
|
||||||
db.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
|
db.executeSql('DROP TABLE IF EXISTS test_table');
|
||||||
db.transaction(function(tx) {
|
db.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
|
||||||
return tx.executeSql(["INSERT INTO test_table (data, data_num) VALUES (?,?)", "test", 100], function(res) {
|
db.transaction(function(tx) {
|
||||||
console.log("insertId: " + res.insertId + " -- probably 1");
|
return tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)",[ "test", 100], function(res) {
|
||||||
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
|
console.log("insertId: " + res.insertId + " -- probably 1");
|
||||||
return db.executeSql("select count(id) as cnt from test_table;", function(res) {
|
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
|
||||||
console.log("rows.length: " + res.rows.length + " -- should be 1");
|
return db.executeSql("select count(id) as cnt from test_table;", [], function(res) {
|
||||||
return console.log("rows[0].cnt: " + res.rows[0].cnt + " -- should be 1");
|
console.log("rows.length: " + res.rows.length + " -- should be 1");
|
||||||
});
|
return console.log("rows[0].cnt: " + res.rows[0].cnt + " -- should be 1");
|
||||||
}, function(e) {
|
});
|
||||||
return console.log("ERROR: " + e.message);
|
}, function(e) {
|
||||||
});
|
return console.log("ERROR: " + e.message);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Lawnchair Adapter Usage
|
Lawnchair Adapter Usage
|
||||||
|
Loading…
Reference in New Issue
Block a user