Reputation: 1
I have an app built in Ionic/Angular and SQLite with capacitor where I run an update query to my SQLite db.
What happens is that for the changes to make effect in the db I have to re run my Android Studio or go manually to my db on Device Explorer and clic on Synchronize, is this a normal behaviour or is there a way to make this to work automatically?
I tried to close and open my db in my update function that does not work either, any suggestions?
async updateRecord(id: number, name: string){
const query = UPDATE SET name = ? WHERE id = ?;
const values = [id, name]
try {
await this.db.run(query, values)
await this.db.close()
await this.db.open()
console.log("Record updated successfully")
} catch (error) {
console.error('Error updating record', error)
}
}
Upvotes: 0
Views: 33