So, i did this:
i have installed two plugins: cordova-sqlite-storage and cordova-plugin-dbcopy.
First time i have to copy the database, and after open it:
window.plugins.sqlDB.remove(“mydb.db”,0, function deleteSuccess(){
console.log(‘deleted’)
}, function deleteError(error){
});
let self = this;
window.plugins.sqlDB.copy(“mydb.db”, 0, function copySuccess(){
console.log(‘copiedd’)
self.sqlite.create({
name: ‘hymnal.db’,
location: ‘default’
}).then((db: SQLiteObject) => {
db.executeSql(“select * from table”, {}).then((res) => {
//console.log(JSON.stringify(res))
}).catch((e) => {
console.log(JSON.stringify(e))
});
})
})
look this:
https://github.com/an-rahulpandey/cordova-plugin-dbcopy
https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database