mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2024-11-12 20:15:05 -05:00
Changes in db.transaction(), tx.executeSql success callback in Legacy PhoneGap version (for peer review)
This commit is contained in:
parent
6e334728c8
commit
c729656c29
19
README.md
19
README.md
@ -175,7 +175,7 @@ Legacy PhoneGap (old version)
|
||||
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.transaction(function(tx) {
|
||||
return tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(res) {
|
||||
return tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(tx, res) {
|
||||
console.log("insertId: " + res.insertId + " -- probably 1");
|
||||
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
|
||||
return db.executeSql("select count(id) as cnt from test_table;", [], function(res) {
|
||||
@ -187,6 +187,23 @@ Legacy PhoneGap (old version)
|
||||
});
|
||||
});
|
||||
|
||||
## Changes in tx.executeSql success callback
|
||||
|
||||
var db;
|
||||
db = new PGSQLitePlugin("test_native.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("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], function(res) {
|
||||
console.log("insertId: " + res.insertId + " -- probably 1");
|
||||
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
|
||||
db.transaction(function(tx) {
|
||||
return tx.executeSql("select count(id) as cnt from test_table;", [], function(tx, res) {
|
||||
console.log("rows.length: " + res.rows.length + " -- should be 1");
|
||||
return console.log("rows[0].cnt: " + res.rows.item[0].cnt + " -- should be 1");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Lawnchair Adapter Usage
|
||||
=======================
|
||||
|
Loading…
Reference in New Issue
Block a user