且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查sqlite phonegap中列中的重复项目

更新时间:2023-01-19 15:15:46

('。caseName_h')。val()){
alert(文件夹已退出。);
isvalid = false;
休息;
return ;;
}
}
}





我这样称呼这个。

 


(document).on('click','#AddButton',function(){
isvalid = validationField ();
if(isvalid){
insertData();
window.requestFileSystem(LocalFileSystem.PERSISTENT,0,onFileSystemSuccess,onFileSystemFail);
}
}) ;


need to check duplicate item in my table before insert date .But i am getting error while checking.Here is my code.I need to check whether the element already exist then return false If not then return true.And create a new entry

function validationField() {
     db.transaction(getallTableCntend, errorCB);
   }

   function getallTableCntend(tx) {
       tx.executeSql('SELECT * FROM CaseTable', [], queryexcecute, errorCB);
   }
   function queryexcecute(tx, result) {
       var len = result.rows.length;

       for (var i = 0; i < len; i++) {
         if(result.rows.item(i).CaseName ==$('.caseName_h').val()){
           alert("Folder is already Exit.");
           isvalid=false;
           Break;
           return;;
         }
       }
      }



I am calling this like this.

$(document).on('click', '#AddButton', function() {
     isvalid = validationField();
    if (isvalid) {
            insertData();
            window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, onFileSystemFail);
    }
});

('.caseName_h').val()){ alert("Folder is already Exit."); isvalid=false; Break; return;; } } }



I am calling this like this.



(document).on('click', '#AddButton', function() { isvalid = validationField(); if (isvalid) { insertData(); window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, onFileSystemFail); } });