Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
openDatabase(){
let name = 'sqlitesynccom_demo';
let loading = this.loadingCtrl.create({
content: 'Opening database. Please wait...'
});
loading.present();
let sqlite_db = new SQLite();
sqlite_db.create({ name: name, location: 'default' }).then((db: SQLiteObject) => {
sqlitesync_DB = db;
Promise.all([
this.getTables()
]).then(val => {
loading.dismiss();
});
}, (error) => {
loading.dismiss();
let alert = this.alertCtrl.create({
title: 'Error',
message: 'Error while opening database: ' + error,
buttons: ['Close']
});
alert.present();
});
return new Promise((resolve,reject) => {
let name = "sqlitesynccom_demo";
let sqlite_db = new SQLite();
sqlite_db.create({
name: name,
location: 'default'
}).then((db: SQLiteObject) => {
resolve(db);
}, (err) => {
reject(err);
});
});
}