我想在SQLite ionic中插入并获取多个json数据,我也希望同步存储的数据。
var query ="INSERT INTO triptable(tripReqId,tripProjectCode,tripProjectName,tripTravellerName,tripStartDate,tripEndDate,tripOriginCity,tripTrNo,tripDestiCity,tripFeedBAckProvided,tripStatus) VALUES (?,?,?,?,?,?,?,?,?,?,?) ";
angular.forEach(function(category){
tripsdata.push(category.tripReqId);
tripsdata.push(category.tripProjectCode);
tripsdata.push(category.tripProjectName);
tripsdata.push(category.tripTravellerName);
tripsdata.push(category.tripStartDate);
tripsdata.push(category.tripEndDate);
tripsdata.push(category.tripOriginCity);
tripsdata.push(category.tripTrNo);
tripsdata.push(category.tripDestiCity);
tripsdata.push(category.tripFeedBAckProvided);
tripsdata.push(category.tripStatus);
});
$cordovaSQLite.execute(db,query,[tripsdata]).then(function(res){
console.log("Rows are inserted"+tripData);
}, function (err) {
console.log("Rows are not Inserted");
});
});