【发布时间】:2013-09-23 04:02:31
【问题描述】:
我在 worklight 中使用 SQL 适配器,我需要有一个变量,我需要在查询中使用它。
我阅读了here 并遵循了相同的内容。但它显示以下错误。
粘贴了有关在 SQL 适配器中使用变量的完整错误消息。
[ERROR ] FWLSE0099E: An error occurred while invoking procedure [project Sample]Device/SqlStatementFWLSE0100E: parameters: [project Sample]{
"arr": [
{
"parameters": [
null
],
"preparedStatement": "UPDATE devices SET DeviceQuantity=$[count] WHERE DeviceNames = 'DellTestLap';"
}
]
}
Parameter index out of range (1 > number of parameters, which is 0)..
Performed query:
UPDATE devices SET DeviceQuantity=$[count] WHERE DeviceNames = 'DellTestLap';
FWLSE0101E: Caused by: [project Sample]java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
com.worklight.common.log.filters.ErrorFilter
项目.js
function UpdateDeviceDetails(){
var count = 2;
var invocationData2 = {
adapter : 'Device', // adapter name
procedure : 'UpdateDeviceDetails', // procedure name
parameters : [count]
};
WL.Client.invokeProcedure(invocationData2,{
onSuccess : QuerySuccess,
onFailure : QueryFailure
});
}
Adapter.js
var DeviceDetails = WL.Server.createSQLStatement("UPDATE devices SET DeviceQuantity=$[count] WHERE DeviceNames = 'DellTestLap';");
function UpdateDeviceDetails(count) {
return WL.Server.invokeSQLStatement({
preparedStatement :DeviceDetails,
parameters : [count]
});
}
【问题讨论】:
-
adapter.js中的SQL语句和你引用的错误信息不匹配;请澄清...更新错误或 SQL 语句。 Project.js 中的功能也没有正确关闭,我认为这只是您的复制/粘贴错误?
-
这只是一个复制/粘贴错误 Idan。我已经粘贴了完整的错误。请检查更新的问题。
-
您在该错误中调用了多少次该过程?它似乎吐出了几个迭代。请,只有一次。
-
在错误中显示 '$[count]' 但在您的适配器中它是 $[count] - 请仔细检查适配器和错误并确保它们已同步。如果您对适配器进行了更改,请确保重新部署。由于您要传递数字,因此它应该是 $[count] (理论上也在错误中)。
-
真的很抱歉。当我粘贴完整的控制台页面时,我刚刚检查了一次'$ [count]'。可能你已经看到了那个错误。但实际上我现在正在使用 $[count] 。但无论如何,这两者都是错误的。
标签: sql ibm-mobilefirst worklight-adapters