【发布时间】:2014-04-15 10:03:29
【问题描述】:
我正在创建一个应用程序,在该应用程序中我执行了一个选择,以根据我想要运行另一个选择查询的权限来获取访问权限。但是在这样做的同时,它在 logcat 中给了我 (23) 未授权错误。
var checkAccessQuery = "select * from ug_access where ug_id = '"+window.localStorage.getItem("roleId")+
"' and f_id = "+window.localStorage.getItem("module_id")+" and comp_code = "+window.localStorage.getItem('companyCode')+"";
var query1 = '';
var moduleId ='';
var pkId ='';
$(function(tx){
db.transaction(function(tx){
tx.executeSql(checkAccessQuery,[],function(tx,results){
var dataset = results.rows.length;
if(dataset>0)
{
}else{
window.localStorage.setItem('accessDenied',true);
window.location.href = 'home.html';
}
console.log('value in module_id: '+window.localStorage.getItem('module_Id'));
window.localStorage.setItem('sessionModuleId',window.localStorage.getItem('module_Id'));
var innerModule = 0;
if(window.localStorage.getItem('innerModule') != 'undefined' || window.localStorage.getItem('innerModule') !='' )
{
innerModule = window.localStorage.getItem('innerModule');
}
moduleId = 0;
if(window.localStorage.getItem('module_Id') != 'undefined' || window.localStorage.getItem('module_Id') != '' )
{
moduleId = window.localStorage.getItem('module_Id');
}
pkId = 0;
if(window.localStorage.getItem('pkIdDelete') != 'undefined' || window.localStorage.getItem('pkIdDelete') != '')
{
pkId = window.localStorage.getItem('pkIdDelete');
}
if(pkId !=0)
{
tx.executeSql('select * from user_form',[],function(tx,result){
var dataset = result.rows.length;
console.log('length of the dynamic_form: '+dataset);
});
}
});
},errorCb,sucessCb);
});
谁能帮我解决这个问题。 任何想法表示赞赏.. 提前致谢。
【问题讨论】:
-
neerav 我遇到了同样的问题并解决了...你能解释一下上面的代码是做什么的吗...
-
Aravinth 第一次在其结果中执行时,我们检查 pkId 如果它不为空,则执行第二个查询以从用户表中获取结果,因此我可能需要在上述函数中执行更多查询以最后动态创建删除查询。
-
好的,现在评论这个 window.location.href = 'home.html';在其他部分然后运行..
-
好的,现在它没有给出这个错误,但你能告诉我到底发生了什么......
-
yep...good..当我们调用外部页面时,当前页面元素没有被调用,所以查询显示错误。你可以解决这个问题。