Skip to content

Commit

Permalink
Add transaction to included app
Browse files Browse the repository at this point in the history
Add functions to test transaction are working and to show how use them.
  • Loading branch information
davibe committed May 5, 2012
1 parent e2d1b3b commit 3621ad9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@
console.log (JSON.stringify (row, null, ' '));
}

res.rows.forEach (onRow);
transact ();
}

function transact () {
console.log ("Start a transaction");
db.transaction (onTransaction);
}

function onTransaction (tx) {
console.log ("Execute transaction");
tx.executeSql(['SELECT * FROM "test" where Id = 1;'], onTxDone, onFail);
}

function onTxDone (res) {
console.log('-> Got the data from transaction');
console.log(res);

function onRow (row) {
console.log (JSON.stringify (row, null, ' '));
}

res.rows.forEach (onRow);
}

Expand Down

0 comments on commit 3621ad9

Please sign in to comment.