JSONStore push() 给出 "Data conversion error"
JSONStore push() gives "Data conversion error"
我使用的是 MobileFirst Platform 6.3.0.00-20141218-1823。
使用以下 JSONStore 推送代码片段 returns 出现错误:
Procedure invocation error. Runtime: Data conversion error converting "{""FIRSTNAME"":""abcd"",""CONTACTNO"":9090909099,""ID"":2,""EMAIL"":""abcd@gmail.com"",""LASTNAME"":""xyz""}"; SQL statement:
delete from addressbook where id=? [22018-184].
Performed query:
delete from addressbook where id=?
代码:
WL.JSONStore.get(collectionName).countAllDirty().then(function(numberOfDirtyDocs){
if(numberOfDirtyDocs > 0){
WL.JSONStore.get(collectionName).push().then(function(){
deferred.resolve(true);
}).fail(function(errorObject){
deferred.reject(false);
});
deferred.resolve(numberOfDirtyDocs);
}else{
deferred.reject(numberOfDirtyDocs);
}
}).fail(function(errorObject){
deferred.reject(errorObject);
})
如何调试此问题以找到解决方案?
我发现问题出在我的适配器代码中。我不得不
JSON.parse(input object)
在我的适配器代码中。此外,我需要为 json 对象中的键使用大写字母。
我使用的是 MobileFirst Platform 6.3.0.00-20141218-1823。
使用以下 JSONStore 推送代码片段 returns 出现错误:
Procedure invocation error. Runtime: Data conversion error converting "{""FIRSTNAME"":""abcd"",""CONTACTNO"":9090909099,""ID"":2,""EMAIL"":""abcd@gmail.com"",""LASTNAME"":""xyz""}"; SQL statement:
delete from addressbook where id=? [22018-184].
Performed query:
delete from addressbook where id=?
代码:
WL.JSONStore.get(collectionName).countAllDirty().then(function(numberOfDirtyDocs){
if(numberOfDirtyDocs > 0){
WL.JSONStore.get(collectionName).push().then(function(){
deferred.resolve(true);
}).fail(function(errorObject){
deferred.reject(false);
});
deferred.resolve(numberOfDirtyDocs);
}else{
deferred.reject(numberOfDirtyDocs);
}
}).fail(function(errorObject){
deferred.reject(errorObject);
})
如何调试此问题以找到解决方案?
我发现问题出在我的适配器代码中。我不得不
JSON.parse(input object)
在我的适配器代码中。此外,我需要为 json 对象中的键使用大写字母。