Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SELECT query return only the first row #1013

Open
landry161 opened this issue Jun 8, 2023 · 1 comment
Open

SELECT query return only the first row #1013

landry161 opened this issue Jun 8, 2023 · 1 comment

Comments

@landry161
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant