Not able to see any data on executing select query on a table - SQLite


#1

I’m executing a select query on a table, but it return the row length and the affected rows, but not the data.

My code:

platform.ready().then(() => {

     this.db = new SQLite();
     
     this.db.openDatabase({name: 'abc.db', location: 'default'}).then(()=>{

     this.db.executeSql('select * from userGenDet', []).then((data) => {alert(JSON.stringify(data));
          }, (err) => {
            alert('Unable to execute sql select: '+ err);
          });
  }, (err) => {
      alert('Unable to open database: '+ err);
    });

}); 

Result:
{“rows”:{“length”:1},“rowsAffected”:0}

Please help me with this…


#2

That’s normal, you just need to read the data from each row, e.g. data.rows.item(0).


#3

Thank you. It worked.