0
I’m on a project using Ionic 3 and need to manipulate data in sqlite. The current problem is the following, I run a SELECT in a table and store the return in an array (this.list_off) created in the class. When I use the console.log to show the value of this array INSIDE the database search function, it shows me the data I need, but when I try to use this array outside (after the SELECT that stores the data in it) the array is empty, as if numca had been filled. There is some different way to return and store a SELECT data in sqlite?
getKeyList(){
this.sqlite.create({
name: 'rfleet.bd',
location: 'default'
}).then((db: SQLiteObject) => {
db.executeSql('SELECT * FROM app_teclado WHERE list_id= 1', [])
.then(res => {
for(var i=0; i<res.rows.length; i++) {
this.list_off.push({tec_id:res.rows.item(i).tec_id, tec_codigo:res.rows.item(i).tec_codigo,
tec_data:res.rows.item(i).tec_data, tec_status:res.rows.item(i).tec_status,
inst_id:res.rows.item(i).inst_id, list_id:res.rows.item(i).list_id, tipo:res.rows.item(i).tipo})
}
}).catch(e => console.log("SELECT TECLADO ERROR", e) );
}).catch(e => console.log(e));
}