Can we use one SQLite transaction for two operation SELECT and INSERT?
this.databaseService.executeQuery(async transaction => {
let result = await transaction.executeSql(‘select * from TABLE0’)
if (result == 0) {
transaction.executeSql(‘INSERT INTO TABLE1 (TBL_NAME,PREFIX, NUMBER) values (?,?,?)’, [‘tbl_customer’, ‘tbl_customer’, 1])
.catch(error => {
alert("Error " + error.message);
})
}
}).catch(error => {
let alert = this.alertCtrl.create({
title: ‘App initialize error’,
message: ‘initialize error’,
cssClass: ‘error-alert’,
buttons: [‘OK’]
});
alert.present();
})