Reputation: 645
I am trying to get the whole result as array of rows from sqlite query results object:
I have tried results.rows.item(i).id
and it work just fine but I need to get the whole array of rows instead of only one item, i tried to use rows.array (_number)
from Expo documentation but I can't figure out how actually to use .array(_number)
my code snippet:
iris.transaction(tx => {
tx.executeSql(
`select id, date from days`,
[],
(tx, results) => {
for(i=0; i<results.rows.length; i++){
var date = results.rows.item(i).date.split('-');
}
}
)
});
Upvotes: 2
Views: 3312
Reputation: 5023
As per the Expo document, the result.rows
has an _array
which returns all the items as array, you can try like
if (result && result.rows && result.rows._array) {
/* do something with the items */
// result.rows._array holds all the results.
}
Hope this will help!
Upvotes: 3