2014-04-15 8 views
0

我正在創建一個應用程序,其中我已經執行選擇以獲取訪問權限基礎上的權利我想運行另一個選擇查詢。但是,在做這件事情時,給我(23)在logcat中沒有授權錯誤。獲取Sqlitelog(23)未授權錯誤,同時在phonegap android中選擇查詢.....

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); 


}); 

任何人都可以幫助我解決這個問題。 任何想法是讚賞.. 在此先感謝。

+0

neerav我面臨同樣的問題,解決了......你能解釋一下上面的代碼做什麼... – Aravin

+0

Aravinth當它的結果首先執行我們檢查PKID IFS它不是null,則第二個查詢執行獲取來自users表的結果,所以我可能需要在上面的函數中執行幾個更多的查詢來最終動態地創建一個刪除查詢。 –

+1

好吧,現在評論這個window.location.href ='home.html';在其他部分然後運行.. – Aravin

回答

0

這不是解決sqlite 23未授權錯誤的好方案。

db.transaction(function(tx){ 
tx.executeSql(checkAccessQuery,[],function(tx,results){ 
    var dataset = results.rows.length; 
    if(dataset>0) 
    { 

    }else{ 
     window.localStorage.setItem('accessDenied',true); 
     setTimeout(function() { 
      window.location.href = 'home.html'; 
     }, 1500); 

    } 
}); 
+0

仍然給它同樣的錯誤..... –

+0

增加時間.. – Aravin

相關問題