bool CHtmlHandler::DataHandler(CString op,CString scmd) { bool brefresh=true; if (op.Compare("init") == 0) { if(g_RGroup.sDataLst.IsEmpty()) { //try to import the test result first CString Rtype(SCHEME_LIST);//find the result type if(SJFindFirstMatchByTxt(m_gPath+"\\Data\\temp.htm",Rtype)) //extract the result if(SJExtractTxtByMark(m_gPath+"\\Data\\"+Rtype+".htm",m_gPath+"\\Data\\temp.htm",MDB_PATTERN,DataCallBack_Extract)){ SqlDelete(PathQuery(CLSMDB,IDDATA),"测试结果",g_RGroup.sRegSel); SqlAdd(PathQuery(CLSMDB,IDDATA),"测试结果",g_RGroup.sRegSel); } //set the corresponding Data Setting g_RGroup.sDataLst = SqlNames(PathQuery(CLSMDB,IDDATA),"*",g_RGroup.sRegSel); } scmd = (g_RGroup.sDataSel.IsEmpty())?TEXT("测试结果"):g_RGroup.sDataSel;//set the initial dataset if (g_RGroup.sDataLst.Find(scmd,0) < 0) scmd = g_RGroup.sDataLst.Left(g_RGroup.sDataLst.Find(',',0)); if(g_RGroup.sJhSel1.IsEmpty()) JhHandler("init","");//initial setting of jh op = _T("select"); } if(op.Compare("add") == 0) { SqlSelect(PathQuery(CLSMDB,IDDATA),g_RGroup.sDataSel,g_RGroup.sRegSel); g_RGroup.sDataSel = SqlAdd(PathQuery(CLSMDB,IDDATA),scmd,g_RGroup.sRegSel); g_RGroup.sDataLst = SqlNames(PathQuery(CLSMDB,IDDATA),"*",g_RGroup.sRegSel); } if(op.Compare("delete") == 0) { g_RGroup.sDataSel = SqlDelete(PathQuery(CLSMDB,IDDATA),scmd,g_RGroup.sRegSel); g_RGroup.sDataLst = SqlNames(PathQuery(CLSMDB,IDDATA),"*",g_RGroup.sRegSel); } if(op.Compare("select") == 0) { g_RGroup.sDataSel = SqlSelect(PathQuery(CLSMDB,IDDATA),scmd,g_RGroup.sRegSel); } if(op.Compare("check") == 0) { SqlSelect(PathQuery(CLSMDB,IDDATA),g_RGroup.sDataSel,g_RGroup.sRegSel); SqlSelect(PathQuery(CLSMDB,IDJH),g_RGroup.sJhSel1,PathQuery(CLSGROUP,IDJH)); this->DataIntegrateForCheck(g_msTemp,ZINDEX_MAX,true); } g_msTemp.SetAt("datalst",g_RGroup.sDataLst); g_msTemp.SetAt("datasz",g_RGroup.sDataSel); g_msTemp.SetAt("jhsz",g_RGroup.sJhSel1); g_msTemp.SetAt("curview","datahtm"); g_msTemp.SetAt("curhtm","datahtm"); if(brefresh) SJReplaceTxtByMark(m_gPath+PathQuery(CLSJS,IDDATA),m_gPath+DATA_FORM,MDB_PATTERN,CallBack_Replace); return brefresh; }
bool CHtmlHandler::Configure1Handler(CString op,CString scmd) { bool brefresh=true; if(op.Compare("init") == 0) { //set the corresponding jhsetting g_RGroup.sConfLst1 = SqlNames(PathQuery(CLSMDB,IDCONF1),"*",PathQuery(CLSGROUP,IDCONF1)); //determine the initial value scmd = g_RGroup.sConfSel1; if (scmd.IsEmpty()){ Configure2Handler("init",""); scmd = DEFAULT_NAME; //select the default corresponding value g_msTemp.RemoveAll(); g_RGroup.sConfSel1 = SqlSelect(PathQuery(CLSMDB,IDCONF1),scmd,PathQuery(CLSGROUP,IDCONF1)); //intial part of the g_TesterConf UpdateRstdSetting(); g_TesterConf.m_RsDefault = g_TesterConf.m_Rs; } if(g_RGroup.sConfLst1.Find(scmd,0) < 0) scmd = DEFAULT_NAME; op = "select"; } if(op.Compare("add") == 0) { if(scmd != DEFAULT_NAME ){ g_RGroup.sConfSel1 = SqlAdd(PathQuery(CLSMDB,IDCONF1),scmd,PathQuery(CLSGROUP,IDCONF1)); g_RGroup.sConfLst1 = SqlNames(PathQuery(CLSMDB,IDCONF1),"*",PathQuery(CLSGROUP,IDCONF1)); } } if(op.Compare("delete") == 0) { if(scmd != DEFAULT_NAME ){ g_RGroup.sConfSel1 = SqlDelete(PathQuery(CLSMDB,IDCONF1),scmd,PathQuery(CLSGROUP,IDCONF1)); g_RGroup.sConfLst1 = SqlNames(PathQuery(CLSMDB,IDCONF1),"*",PathQuery(CLSGROUP,IDCONF1)); } } if(op.Compare("select") == 0) { g_msTemp.RemoveAll(); g_RGroup.sConfSel1 = SqlSelect(PathQuery(CLSMDB,IDCONF1),scmd,PathQuery(CLSGROUP,IDCONF1)); } g_msTemp.SetAt("conf1lst",g_RGroup.sConfLst1); g_msTemp.SetAt("conf1sz",g_RGroup.sConfSel1); g_msTemp.SetAt("curview","testhtm"); g_msTemp.SetAt("curhtm","confhtm"); if(brefresh) SJReplaceTxtByMark(m_gPath+PathQuery(CLSJS,IDCONF1),m_gPath+CONF1_FORM,MDB_PATTERN,CallBack_Replace); return brefresh; }
bool CHtmlHandler::Configure2Handler(CString op,CString scmd) { bool brefresh=true; if(op.Compare("init") == 0) { //set the corresponding jhsetting g_RGroup.sConfLst2 = SqlNames(PathQuery(CLSMDB,IDCONF2),"*",PathQuery(CLSGROUP,IDCONF2)); //initial value scmd = g_RGroup.sConfSel2; if (scmd.IsEmpty() ){ scmd = DEFAULT_NAME; g_msTemp.RemoveAll(); g_RGroup.sConfSel2 = SqlSelect(PathQuery(CLSMDB,IDCONF2),scmd,PathQuery(CLSGROUP,IDCONF2)); UpdateRstdSetting(); } if (g_RGroup.sConfLst2.Find(scmd,0) < 0) scmd = DEFAULT_NAME; op = _T("select"); } if(op.Compare("add") == 0) { g_RGroup.sConfSel2 = SqlAdd(PathQuery(CLSMDB,IDCONF2),scmd,PathQuery(CLSGROUP,IDCONF2)); g_RGroup.sConfLst2 = SqlNames(PathQuery(CLSMDB,IDCONF2),"*",PathQuery(CLSGROUP,IDCONF2)); } if(op.Compare("delete") == 0) { g_RGroup.sConfSel2 = SqlDelete(PathQuery(CLSMDB,IDCONF2),scmd,PathQuery(CLSGROUP,IDCONF2)); g_RGroup.sConfLst2 = SqlNames(PathQuery(CLSMDB,IDCONF2),"*",PathQuery(CLSGROUP,IDCONF2)); } if(op.Compare("select") == 0) { g_msTemp.RemoveAll(); g_RGroup.sConfSel2 = SqlSelect(PathQuery(CLSMDB,IDCONF2),scmd,PathQuery(CLSGROUP,IDCONF2)); } g_msTemp.SetAt("conf2lst",g_RGroup.sConfLst2); g_msTemp.SetAt("conf2sz",g_RGroup.sConfSel2); g_msTemp.SetAt("curview","testhtm"); g_msTemp.SetAt("curhtm","confhtm"); if(brefresh) SJReplaceTxtByMark(m_gPath+PathQuery(CLSJS,IDCONF2),m_gPath+CONF2_FORM,MDB_PATTERN,CallBack_Replace); return brefresh; }
bool CHtmlHandler::RegHandler(CString op,CString scmd) { bool brefresh = true; if(op.Compare("init") == 0) { TbrHandler("init",""); g_RGroup.sRegLst = SqlNames(PathQuery(CLSMDB,IDREG),"*",PathQuery(CLSGROUP,IDREG)); if( g_RGroup.sRegSel.IsEmpty() || (g_RGroup.sRegLst.Find(g_RGroup.sRegSel,0) < 0)) scmd = g_RGroup.sRegLst.Left(g_RGroup.sRegLst.Find(',',0)); else scmd = g_RGroup.sRegSel;//use the value of last time op = _T("select"); } if(op.Compare("select") == 0) { g_RGroup.sRegSel = SqlSelect(PathQuery(CLSMDB,IDREG),scmd,PathQuery(CLSGROUP,IDREG)); } if(op.Compare("add") == 0) { g_RGroup.sRegSel = SqlAdd(PathQuery(CLSMDB,IDREG),scmd,PathQuery(CLSGROUP,IDREG)); g_RGroup.sRegLst = SqlNames(PathQuery(CLSMDB,IDREG),"*",PathQuery(CLSGROUP,IDREG)); } if(op.Compare("delete") == 0) { g_RGroup.sRegSel = SqlDelete(PathQuery(CLSMDB,IDREG),scmd,PathQuery(CLSGROUP,IDREG)); g_RGroup.sRegLst = SqlNames(PathQuery(CLSMDB,IDREG),"*",PathQuery(CLSGROUP,IDREG)); } //update the g_TestType g_msTemp.Lookup("xhgg",g_TesterConf.m_Xhgg); g_msTemp.SetAt("reglst",g_RGroup.sRegLst); g_msTemp.SetAt("regsz",g_RGroup.sRegSel); g_msTemp.SetAt("curview","reghtm"); g_msTemp.SetAt("curhtm","reghtm"); if(brefresh) SJReplaceTxtByMark(m_gPath+PathQuery(CLSJS,IDREG),m_gPath+REG_FORM,MDB_PATTERN,CallBack_Replace); return brefresh; }
bool CHtmlHandler::JhHandler(CString op,CString scmd) { bool brefresh=true; if(op.Compare("init") == 0) { //set the corresponding jhsetting g_RGroup.sJhLst1 = SqlNames(PathQuery(CLSMDB,IDJH),"*",PathQuery(CLSGROUP,IDJH)); scmd = g_TesterConf.m_Xhgg; //initial value if (scmd.IsEmpty()||(g_RGroup.sJhLst1.Find(scmd,0) < 0)) scmd = g_RGroup.sJhLst1.Left(g_RGroup.sJhLst1.Find(',',0)); op = _T("select"); } if(op.Compare("add") == 0) { g_RGroup.sJhSel1 = SqlAdd(PathQuery(CLSMDB,IDJH),scmd,PathQuery(CLSGROUP,IDJH)); g_RGroup.sJhLst1 = SqlNames(PathQuery(CLSMDB,IDJH),"*",PathQuery(CLSGROUP,IDJH)); } if(op.Compare("delete") == 0) { g_RGroup.sJhSel1 = SqlDelete(PathQuery(CLSMDB,IDJH),scmd,PathQuery(CLSGROUP,IDJH)); g_RGroup.sJhLst1 = SqlNames(PathQuery(CLSMDB,IDJH),"*",PathQuery(CLSGROUP,IDJH)); } if(op.Compare("select") == 0) { g_RGroup.sJhSel1 = SqlSelect(PathQuery(CLSMDB,IDJH),scmd,PathQuery(CLSGROUP,IDJH)); } g_msTemp.SetAt("jhlst",g_RGroup.sJhLst1); g_msTemp.SetAt("jhsz",g_RGroup.sJhSel1); g_msTemp.SetAt("curview","datahtm"); g_msTemp.SetAt("curhtm","jhhtm"); if(brefresh) SJReplaceTxtByMark(m_gPath+PathQuery(CLSJS,IDJH),m_gPath+"\\Html\\jhform.js","@@*@@",CallBack_Replace); return brefresh; }
bool SqlCalls::SqlDelete(QString table, QSqlDatabase database, QString clausula, QString &error) { QStringList l; l<< clausula; return SqlDelete(table, database, l, error); }