I'm making a phonegap app and using ydn-db there.
The problem is I don't want to do db = new ydn.db.Storage('db-name')
all the time because it creates a new database. Is there a way to check if my database exists already ?
I'm making a phonegap app and using ydn-db there.
The problem is I don't want to do db = new ydn.db.Storage('db-name')
all the time because it creates a new database. Is there a way to check if my database exists already ?
you can also use to check below code.
function onDeviceReady() { var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000); db.transaction(populateDB, errorCB, successCB); }
// Populate the database
//
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
}