我已经编写了 Json 存储,用于在数据库中添加替换删除值。我已经初始化了集合。像这样
function wlCommonInit(){
var collections = {
Users : {
searchFields: { Username: 'integer', Password: 'string'}
},
adapter:{
name:'SQL',
add:'addSQL',
remove:'deleteSQL',
replace:'updateSQL',
load:{
procedure:'getSQLs',
params:[],
}
}
};
WL.JSONStore.init(collections).then(function () {
alert("Collection is declared");
});}
$("#get").bind("click",function(){
WL.JSONStore.get("Users").load().then(function(res1){
alert(JSON.stringify(res1));
});
});
适配器:
var selectStatement = WL.Server.createSQLStatement("select username, password from test");
函数 getSQLs() {
return WL.Server.invokeSQLStatement({
preparedStatement : selectStatement,
parameters : []
});}
运行此即时消息时,出现如下错误:
[wl.jsonstore] {"src":"load","err":18,"msg":"FAILED_TO_LOAD_INITIAL_DATA_FROM_ADAPTER_INVALID_LOAD_OBJ","col":"Users","usr":"jsonstore","doc":{},"res":{}}
您能否让我知道如何从数据库返回值以及如何解决此错误。
问候,
谢赫穆罕默德沙姆努恩