Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

SQLite Query has more than 1 row but keeps throwing exceptions - Angular, Ionic, Android

$
0
0

I have a Ionic Angular applications (Android build)

I have the following:

  getAllUsers() {
    return this.dbInstance.executeSql(`SELECT * from ${this.db_table}`)
      .then((data) => {
        if (data.rows.length > 0) {
          for (let i = 0; i < data.rows.length; i++) {
            console.log('hello world');
            console.log(JSON.stringify(data.rows.item(i)));
          }
        }
      }).catch(e => {
        console.log(JSON.stringify(e));
      });
  }

When I call getAllUsers an exception is automatically thrown with the following console log in android studio

2021-12-30 17:50:32.831 25077-25077/io.ionic.starter I/Capacitor/Console: File: http://localhost/src_app_login_login_module_ts.js - Line 421 - Msg: {"rows":{"length":3},"rowsAffected":0}

This is a log of the query from the console:

2021-12-30 17:50:32.815 25077-25292/io.ionic.starter V/Capacitor/Plugin: To native (Cordova plugin): callbackId: SQLitePlugin1622878251, service: SQLitePlugin, action: backgroundExecuteSqlBatch, actionArgs: [{"dbargs":{"dbname":"userParameters.db"},"executes":[{"sql":"SELECT 1","params":[]},{"sql":"SELECT * from userParametersTable","params":[]}]}]

I am wondering why this behaviour is happening and how to fix this issue.

Thanks

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>