I want to open a database named qw.db in the same folder as my .js file however, seems like it creates a new file qw rather than open my own db file here is my code
function onDeviceReady() {
var shortName = 'qw';
var version = '1.0';
var displayName = 'qwq';
var maxSize = 65535;
if (!window.openDatabase) {
alert('!! Databases are not supported in this Device !! \n\n We are sorry for the inconvenience and are currently working on a version that will work on your phone');
}
db = openDatabase(shortName, version, displayName, maxSize);
createAllTables(db);
}
function createAllTables(db){
db.transaction(function (transaction) {
transaction.executeSql("CREATE TABLE IF NOT EXISTS model(ModelId INTEGER PRIMARY KEY AUTOINCREMENT,ModelNumber varchr(50))");
});
db.transaction(function(transaction){
var rowCount = 'SELECT * FROM model';
transaction.executeSql(rowCount,[],function(transaction,result){
if(result.rows.length == 0){
var sqlString = 'INSERT INTO model (ModelId,ModelNumber) VALUES("200","Female")';
transaction.executeSql(sqlString);
}
});
});
}
here is a reference if needed Phonegap Offline Database