storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.14k stars 713 forks source link

SELECT query return only the first row #1013

Open landry161 opened 11 months ago

landry161 commented 11 months ago

Hi everybody. I'm using this plugin with ionic capacitor. The insert query works fine. But where i use the select query. cnx.create({ name:"ionic-capacitor.db", location:"default" }).then((db:SQLiteObject)=>{ db.executeSql("SELECT id,value_one,value_twoFROM tasks",[]).then((resultTasks)=> { for(let index=0;index<resultTasks.rows.length;index++) { alert("Only the first row is displayed "+JSON.stringify(resultTasks.rows.item(index))); myTasks.push({ id:resultTasks.rows.item(index).id, one:resultTasks.rows.item(index).value_one, two:resultTasks.rows.item(index).value_two }); } result(resultTasks); }).catch((error)=>{ fail(error); }); }).catch((error)=>{ fail(error); });

Can you help me please ? Thanks.

landry161 commented 11 months ago

Hi i solve the problem. The syntax declaration was var myTasks:any[]; I changed it by var myTasks=Array();
:(