I am trying to insert multiple rows in SQLite using ionic framework. Single row insert in working fine.
even if i run
INSERT INTO categories (category_id, category_name,category_type) VALUES (1,"test",1),(2,"test again", 2);
this is also working fine. but when i try to create a dynamic string it gives me error "could not prepare statement (1 near "?": syntax error)".
.success((function (result) {
var query = "INSERT INTO categories (category_id, category_name,category_type) VALUES ?";
var data = [];
result.forEach(function (category) {
data.push([category.id, category.category_name, category.category_type]);
});
$cordovaSQLite.execute(db, query,[data]).then(function (res) {
console.log("inserted");
}, function (err) {
console.dir(err);
});