0

06-27 13:30:36.635: I/SqliteDatabaseCpp(6490): sqlite 返回: 错误代码 = 1, msg = "AIRCRAFT" 附近: 语法错误, db=xxx

嗨,我在 android 中使用 phonegap storage 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);
}

}

任何人都可以帮助我查询中的语法错误吗?

4

1 回答 1

0

要更新的字段之间必须有逗号:

sql = "UPDATE AIRCRAFT SET AIRCRAFT_ID='"+...+"',  AIRCRAFT='"+..."+"', ...";
于 2013-06-27T09:37:08.043 回答