diff --git a/QueryPropertyServer/DbProxy.cpp b/QueryPropertyServer/DbProxy.cpp index faa5ff12..275be09d 100644 --- a/QueryPropertyServer/DbProxy.cpp +++ b/QueryPropertyServer/DbProxy.cpp @@ -550,13 +550,21 @@ void query(int iThread, const TC_DBConf & conf, map& mSqlPart, ma string sTbName(""); string sSql(""); + + string sCutType = g_pconf->get("/tars/reapSql", "hour"); + bool cutByDay = (sCutType == "day"); + //select range by f_date and f_tflag for(string day = dateFrom; day <= dateTo; day = dateInc(day)) { for(string tflag = tflagFrom; tflag <= tflagTo && (tflag.substr(0,2) < "24"); tflag = tFlagInc(tflag)) { //table name:tars_2012060723 - sTbName = sTbNamePre + day + tflag.substr(0,2); + sTbName = sTbNamePre + day; + if (!cutByDay) { + sTbName += tflag.substr(0,2); + } + //sTbName = sTbNamePre + day + tflag.substr(0,2); sSql = "select " + selectCond + " from " + sTbName + " " + ignoreKey + whereCond + groupCond + " order by null;"; @@ -598,6 +606,10 @@ void query(int iThread, const TC_DBConf & conf, map& mSqlPart, ma } TLOGINFO("query iDb :" << iThread << " day:" << day <<" tflag:" << tflag << endl); + + if (cutByDay) { + break; + } } } //day diff --git a/QueryStatServer/DbProxy.cpp b/QueryStatServer/DbProxy.cpp index 1b6a5714..c9786cd4 100644 --- a/QueryStatServer/DbProxy.cpp +++ b/QueryStatServer/DbProxy.cpp @@ -498,13 +498,21 @@ void query(int iThread, const TC_DBConf & conf, map& mSqlPart, ma string sTbName(""); string sSql(""); + + string sCutType = g_pconf->get("/tars/reapSql", "hour"); + bool cutByDay = (sCutType == "day"); + //select range by f_date and f_tflag for(string day = dateFrom; day <= dateTo; day = dateInc(day)) { for(string tflag = tflagFrom; tflag <= tflagTo && (tflag.substr(0,2) < "24"); tflag = tFlagInc(tflag)) { //table name:tars_2012060723 - sTbName = sTbNamePre + day + tflag.substr(0,2); + sTbName = sTbNamePre + day; + if (!cutByDay) { + sTbName += tflag.substr(0,2); + } + //sTbName = sTbNamePre + day + tflag.substr(0,2); sSql = "select " + selectCond + " from " + sTbName + " " + ignoreKey + whereCond + groupCond + " order by null;"; @@ -548,6 +556,10 @@ void query(int iThread, const TC_DBConf & conf, map& mSqlPart, ma } TLOGINFO("query iDb :" << iThread << " day:" << day <<" tflag:" << tflag << endl); + + if (cutByDay) { + break; + } } } //day