06-27 13:30:36.635:I / SqliteDatabaseCpp(6490):sqlite返回:错误代码= 1,msg =接近“AIRCRAFT”:语法错误,db = xxx
您好我在android中使用带有以下代码的phonegap存储api面临上述问题
function updateAircraft(tx, data) {
try {
var sql = "UPDATE AIRCRAFT SET AIRCRAFT_ID='"+data.aircraftId+"' AIRCRAFT='"+data.tailNumber+"' OPERATOR_ID='"+data.operatorId+"' FLIGHT_SCHEDULE_ID='"+data.flightScheduleId+"' ETOPS_CERTIFIED_IND='"+data.etopsCertifiedInd+"' RVSM_CERTIFIED_IND='"+data.rvsmCertifiedInd+"' STOCK_NUM_CODE='"+data.stockNumberCode+"' WHERE AIRCRAFT_ID='" + data.aircraftId+"'";
console.log(sql);
//tx.executeSql(sql, [data.aircraftId, data.tailNumber, data.operatorId, data.flightScheduleId, data.etopsCertifiedInd, data.rvsmCertifiedInd, data.stockNumberCode],updateAircraftSuccessCB,updateAircraftErrorCB)
tx.executeSql(sql, [],updateAircraftSuccessCB,updateAircraftErrorCB)
console.log('updated record into aircrat' + data.aircraftId);
} catch (err) {
console.log(err.message);
}
}
任何人都可以帮助我查询中的语法错误吗?
答案 0 :(得分:0)
要更新的字段之间有must be commas:
sql = "UPDATE AIRCRAFT SET AIRCRAFT_ID='"+...+"', AIRCRAFT='"+..."+"', ...";