|
写的一个上传文件的逻辑,从slite中查询修改上传文件的状态
sql = "update UPLOAD set UPSTATUS = '上传中' where UPLOADID ='"+UPLOADID+"';";
self.noQuery(sql);
self.UPLOADSEQUENCE_judge();
//sql的运行
Model.prototype.noQuery=function(sql){
//初始化ptDB,获取其DataBase
this.ptDB = ptDB.getInstance();
var db = this.ptDB.getDatabase();
// 执行SQL查询
SqliteUtil.executeSql(db, sql, []);
};
///这是那个方法
Model.prototype.UPLOADSEQUENCE_judge = function(){
this.comp("UPLOAD").refreshData();
// alert("主判断");
self = this;
var UPLOAD = self.comp("UPLOAD");
var MainRows1 =UPLOAD.find(['UPSTATUS'],['上传中']);
if(MainRows1.length !=0){
var UPLOADID = MainRows1[0].val('UPLOADID');
// alert("主上传中ID:"+UPLOADID);
self.UPLOADSEQUENCE_1(UPLOADID);
}else{
var MainRows2 =UPLOAD.find(['UPSTATUS'],['待上传']);
if(MainRows2.length !=0){
var UPLOADID = MainRows2[0].val('UPLOADID');
// alert("主待上传ID:"+UPLOADID);
self.UPLOADSEQUENCE_1(UPLOADID);
}else{
var MainRows3 =UPLOAD.find(['UPSTATUS'],['未上传']);
if(MainRows3.length !=0){
var UPLOADID = MainRows3[0].val('UPLOADID');
// alert("主未上传ID:"+UPLOADID);
self.UPLOADSEQUENCE_1(UPLOADID);
}else{
}
}
然后到下一个方法UPLOADSEQUENCE_judge()中执行状态判断以后,才执行了sqlite语句,修改了状态
怎样才能等sqlite执行成功以后才到下一个方法 |
|