Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * _dbqueries is an object for storing the queries my app is using. _dbqueries.createTables
- * is an array of the sql statements for creating the tables the app is going to need.
- *
- * _mySELFDb is a WebDB object in the same closure as this snippet. The closure contains all
- * the functions for managing the database, so it's self-contained.
- */
- _createTables = function () {
- var _increment, _queries, _tableMaker;
- _queries = _dbqueries.createTables;
- _increment = 0;
- _tableMaker = function (tx, i) {
- i += 1;
- if (_queries[i - 1]) {
- console.log('Installing... executing :' + _queries[i - 1]);
- tx.executeSql(_queries[i - 1], [], function (tx, result) {
- _tableMaker(tx, i);
- });
- } else {
- console.log('Finished');
- }
- };
- if ('function' === typeof _mySELFDb.transaction) {
- _mySELFDb.transaction(function (tx) {
- _tableMaker(tx, _increment);
- });
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement