Question about SQLStorage and retrieving many rows


#1

Hi,

Quick one for you.

Here, from Ionic example:

storage.query('insert into projects(name, data) values("Cool Project", "blah")');
storage.query('select * from projects').then((resp) => {})

If the “select” returns more than one records, how can I get columns info from “resp” for each rows?

I have something like

resp.res.rows[0].column1
resp.res.rows[0].column2
resp.res.rows[1].column1
resp.res.rows[1].column1

but does not seems to work. It is ok on Chrome directly with ionic serve, but when using "Chrome inspect directly with a phone, it does not return correctly the value:

EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot read property ‘column1’ of undefined

Thanks


#2

Found my mistake!

It should be:

resp.res.rows.item(0).column1