Created
August 11, 2008 18:40
-
-
Save KirinDave/4915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validate_tables: function() { | |
// Sometimes you can have as much fun indoors as outdoors. | |
var self = this; | |
var found = 0; var needed = this.tables.length; var reported = 0; | |
var callback = function(present) { | |
if(present) { | |
found += 1; | |
} | |
reported += 1; | |
if(reported == needed) { | |
if(found < needed) { | |
self.insert_schema(); | |
} | |
self.setup_helpers(); | |
self.initalized = true | |
} | |
} | |
this.tables.each( function(x) { | |
self.db_handle.transaction( function(tx) { | |
tx.executeSql( "SELECT COUNT(*) FROM " + x[0], [], | |
function(tx, r) {callback(true)}, | |
function(tx, error) {callback(false)}) | |
}) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment