大家好!我是范范。本人刚接触ST2到现在刚刚两个月,6月1号接的项目,那时才知道有Sencha Touch2这个东西,到现在两个月了期间的幸酸就不说了。今天说说在项目中用到的HTML5的本地存储。可能有的地方不是很合理,大家可以提出宝贵意见。下面开整:
下面是创建数据库的代码:database.js
var initDatabase = function(db,tables){ for(var i=0;i下面是建表的代码:CreateTable.js0){ var ids = ""; for(var index=0;index 0){ newArray[k+1] = fildData; newArrayFilds[k+1]=name; k=k+1; }else{ newArray[k] = fildData; newArrayFilds[k]=name; } } } return newArray; } };var newArrayFilds = new Array();
//建表var creatTables ={ sqls :function(){ var tables = new Array(2);//表的个数 //基础数据表、参数表 tables[0] = "CREATE TABLE IF NOT EXISTS t_Question (question_id int, project_id string,category_id int,pj_node_code string,location string,description string,cs_id int,fix_requirement string,fix_date datetime,question_priority string,submit_user_id int,submit_date datetime,question_status int,amount number,IsSubmit int )";
tables[1] = "CREATE TABLE IF NOT EXISTS t_QuestionUser (question_id string,user_type string,user_id int)";return tables; } }; 下面是存入时的数据集合:
var questionArray = new Array("question_id","project_id","category_id","pj_node_code","location","description","cs_id","fix_requirement","fix_date","question_priority","submit_user_id","submit_date","question_status","amount","IsSubmit");
var questionUserArray = new Array("question_id","user_type","user_id");