Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionic capacitor android: executeSql always returns a rejected promise #999

Open
skrs13 opened this issue Feb 9, 2022 · 0 comments
Open

Comments

@skrs13
Copy link

skrs13 commented Feb 9, 2022

ionic version - 6.18.1
cordova --version: 11.0.0
Angular CLI: 13.1.4
Android: 12 (SDK: 31)

executeSql API always returns a rejected promise even for successful execution of queries. For instance, the following table creation returns an error but the table is created successfully - I've verified this by downloading the .db file and opening it with DB Browser for SQLite.

query = `CREATE TABLE IF NOT EXISTS test_table 
                 id INTEGER PRIMARY KEY NOT NULL,
                 col1 INTEGER NULL DEFAULT NULL,
                 col2 CHAR(20) NULL DEFAULT NULL,
                 col3 CHAR(20) NULL DEFAULT NULL,`
        this.dbEngine
            .executeSql(query)
            .then(() => {
                console.log('Table created');
            })
            .catch((e) => {
                console.log(`Table creation error: ${JSON.stringify(e)}`);
            });

Android Logcat has the following output:

Msg: Table creation error: {"rows":{"length":0},"rowsAffected":0}

I have also verified successful insertions into the table but the promise is always returned as rejected. Any query executed with executeSql returns as rejected. But the same query executed with sqlBatch returns a resolved promise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant