Ionic SQLite plugin always throws an exception when deleting

111 Views Asked by At

I have an SQLite database, testing on my Android device, with a simple table, where whenever I execute a delete, it always throws an exception, even though the delete succeeds. I can tell it has succeed as the data is gone from the database.

My SQL looks like the following:

    let db = await this.sqlite.create({name: 'mydb.sqlite', location: 'default'});
    let delSql = `DELETE FROM ${this.TABLE_NAME} WHERE GroupName = '${groupName}' AND Id IN  ('CAR01','CAR02');
    await db.executeSql(delSql);

Catching the exception, it will always throw:

enter image description here

I have tried to follow the source for the plugin it wraps here, but, as we can see at line 163:

try {
        rowsAffected = myStatement.executeUpdateDelete();
        // Indicate valid results:
        needRawQuery = false;

rowsAffected seems to be set if no exception is thrown, yet in my case (as in the screenshot) this comes back as 9, yet I still get an exception.

Why do I always get an exception?

0

There are 0 best solutions below