优化这段代码 if( DBData[i] >= RT1064KZZ_GL1_ALM && DBData[i] <= RT1064KZZ_KZHL && DBData[i] != RT1064KZZ_MODE && DBData[i] != RT1064KZZ_UAB_CH && DBData[i] != RT1064KZZ_UBC_CH && DBData[i] != RT1064KZZ_FBS && DBData[i] != RT1064KZZ_FBS_MODE) { (isDraw ? LCD_DisString_Not((i%LISTOFFSET)+1, 20,(char *)gcszOnOff[(int)val]) : LCD_DisString((i%LISTOFFSET)+1, 20,(char *)gcszOnOff[(int)val]) ); } else if(DBData[i] == RT1064KZZ_MODE) { (isDraw ? LCD_DisString_Not((i%LISTOFFSET)+1, 20,(char *)ModeName[(int)val]) : LCD_DisString((i%LISTOFFSET)+1, 20,(char *)ModeName[(int)val]) ); } else if (DBData[i] == RT1064KZZ_FBS || DBData[i] == RT1064KZZ_FBS_MODE ) { (isDraw ? LCD_DisString_Not((i%LISTOFFSET)+1, 20,(char *)FBS_NAME[(int)val]) : LCD_DisString((i%LISTOFFSET)+1, 20,(char *)FBS_NAME[(int)val]) ); } else if(DBData[i] == RT1064KZZ_UAB_CH || DBData[i] == RT1064KZZ_UBC_CH || DBData[i] == RT1064_DZ_CHZCS) { sprintf(szVal, "%0.f" , val); LCD_DisString((i%LISTOFFSET)+1, 19 , szVal); if(DBData[i] == RT1064_DZ_CHZCS) LCD_DisString((i%LISTOFFSET)+1, 24, (char *)"次"); if (isDraw == 1) len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); } else { sprintf(szVal, "%0.3f" , get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])); LCD_DisString((i%LISTOFFSET)+1, 19, szVal); if (DBData[i] >= RT1064_YS_GL1 && DBData[i] <= RT1064_YS_FBS_JY) LCD_DisString((i%9)+1, 25, (char *)"S"); else if ((DBData[i] >= RT1064_DZ_GL1 && DBData[i] <= RT1064_DZ_I02) || ((DBData[i] >= RT1064_DZ_PHASE_I && DBData[i] <= RT1064_DZ_I0DLT) && DBData[i] != RT1064_DZ_YL_HAR && DBData[i] != RT1064_DZ_LMJ) || DBData[i] == RT1064_DZ_SD || DBData[i] == RT1064_DZ_I0HJS || DBData[i] == RT1064_DZ_FC_CHZ || (DBData[i] >= RT1064_DZ_I03 && DBData[i] <= RT1064_DZ_FBS_I0)|| DBData[i] == RT1064_DZ_FBS_OL) { LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"A"); } else if (DBData[i] == RT1064_DZ_LMJ || DBData[i] == RT1064_DZ_JC || DBData[i] == RT1064_DZ_GYJC) { LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"°"); } else if (DBData[i] == RT1064_DZ_YL_HAR) LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"%"); else if (DBData[i] == RT1064_DZ_IDS ||DBData[i] == RT1064_DZ_OPENCS || (DBData[i] >= RT1064_DZ_I03 && DBData[i] <= RT1064_DZ_FBS_I0)) { LCD_DisString((i%LISTOFFSET)+1, 24, (char *)"次"); } else if (DBData[i] == RT1064_DZ_DP || DBData[i] == RT1064_DZ_GP) { LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"HZ"); } else LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"V"); if (isDraw == 1)len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); }

时间: 2024-03-01 22:52:35 浏览: 20
这段代码可以优化的地方有: 1. 将重复的代码提取出来,避免重复书写。例如,多次调用 `LCD_DisString` 可以提取出来作为一个函数,减少代码重复。 2. 将一些条件语句的判断条件提取出来,避免重复书写。例如,多次使用 `DBData[i]` 的值进行判断,可以将它提取出来,避免重复书写。 3. 使用 switch 语句来替换多个 if-else 语句,使代码更加清晰。 4. 对于 `sprintf(szVal, "%0.3f" , get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i]))` 这一行代码,可以考虑使用 snprintf 函数来避免缓冲区溢出。 下面是一个优化后的代码示例: ``` void displayData(int i, int isDraw, float val, char* szVal, int len) { if (DBData[i] >= RT1064KZZ_GL1_ALM && DBData[i] <= RT1064KZZ_KZHL && DBData[i] != RT1064KZZ_MODE && DBData[i] != RT1064KZZ_UAB_CH && DBData[i] != RT1064KZZ_UBC_CH && DBData[i] != RT1064KZZ_FBS && DBData[i] != RT1064KZZ_FBS_MODE) { displayString(i, isDraw, val, gcszOnOff, (i % LISTOFFSET) + 1, 20); } else if (DBData[i] == RT1064KZZ_MODE) { displayString(i, isDraw, val, ModeName, (i % LISTOFFSET) + 1, 20); } else if (DBData[i] == RT1064KZZ_FBS || DBData[i] == RT1064KZZ_FBS_MODE) { displayString(i, isDraw, val, FBS_NAME, (i % LISTOFFSET) + 1, 20); } else if (DBData[i] == RT1064KZZ_UAB_CH || DBData[i] == RT1064KZZ_UBC_CH || DBData[i] == RT1064_DZ_CHZCS) { snprintf(szVal, sizeof(szVal), "%0.f", val); LCD_DisString((i % LISTOFFSET) + 1, 19, szVal); if (DBData[i] == RT1064_DZ_CHZCS) { LCD_DisString((i % LISTOFFSET) + 1, 24, (char *)"次"); } if (isDraw == 1) { len = LCD_BitNot(UNIT_PROTECT, UNIT_GAP_RT1064, gapid, DBData[i], i, bit); } } else { snprintf(szVal, sizeof(szVal), "%0.3f", get_ActionDZInfo_val(UNIT_GAP_RT1064, gapid, DBData[i])); LCD_DisString((i % LISTOFFSET) + 1, 19, szVal); if (DBData[i] >= RT1064_YS_GL1 && DBData[i] <= RT1064_YS_FBS_JY) { LCD_DisString((i % 9) + 1, 25, (char *)"S"); } else if ((DBData[i] >= RT1064_DZ_GL1 && DBData[i] <= RT1064_DZ_I02) || ((DBData[i] >= RT1064_DZ_PHASE_I && DBData[i] <= RT1064_DZ_I0DLT) && DBData[i] != RT1064_DZ_YL_HAR && DBData[i] != RT1064_DZ_LMJ) || DBData[i] == RT1064_DZ_SD || DBData[i] == RT1064_DZ_I0HJS || DBData[i] == RT1064_DZ_FC_CHZ || (DBData[i] >= RT1064_DZ_I03 && DBData[i] <= RT1064_DZ_FBS_I0)|| DBData[i] == RT1064_DZ_FBS_OL) { LCD_DisString((i % LISTOFFSET) + 1, 25, (char *)"A"); } else if (DBData[i] == RT1064_DZ_LMJ || DBData[i] == RT1064_DZ_JC || DBData[i] == RT1064_DZ_GYJC) { LCD_DisString((i % LISTOFFSET) + 1, 25, (char *)"°"); } else if (DBData[i] == RT1064_DZ_YL_HAR) { LCD_DisString((i % LISTOFFSET) + 1, 25, (char *)"%"); } else if (DBData[i] == RT1064_DZ_IDS || DBData[i] == RT1064_DZ_OPENCS || (DBData[i] >= RT1064_DZ_I03 && DBData[i] <= RT1064_DZ_FBS_I0)) { LCD_DisString((i % LISTOFFSET) + 1, 24, (char *)"次"); } else if (DBData[i] == RT1064_DZ_DP || DBData[i] == RT1064_DZ_GP) { LCD_DisString((i % LISTOFFSET) + 1, 25, (char *)"HZ"); } else { LCD_DisString((i % LISTOFFSET) + 1, 25, (char *)"V"); } if (isDraw == 1) { len = LCD_BitNot(UNIT_PROTECT, UNIT_GAP_RT1064, gapid, DBData[i], i, bit); } } } void displayString(int i, int isDraw, float val, char** stringArray, int x, int y) { (isDraw ? LCD_DisString_Not(x, y, (char *)stringArray[(int)val]) : LCD_DisString(x, y, (char *)stringArray[(int)val])); } ```

相关推荐

帮我优化这段代码 val = get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i]); if( DBData[i] >= RT1064KZZ_GL1_ALM && DBData[i] <= RT1064KZZ_KZHL && DBData[i] != RT1064KZZ_MODE && DBData[i] != RT1064KZZ_UAB_CH && DBData[i] != RT1064KZZ_UBC_CH && DBData[i] != RT1064KZZ_FBS && DBData[i] != RT1064KZZ_FBS_MODE) { displayString(isDraw,gcszOnOff[(int)val],(i%LISTOFFSET)+1,20); } else if(DBData[i] == RT1064KZZ_MODE) { displayString(isDraw,ModeName[(int)val],(i%LISTOFFSET)+1,20); } else if (DBData[i] == RT1064KZZ_FBS || DBData[i] == RT1064KZZ_FBS_MODE ) { displayString(isDraw,(DBData[i] == RT1064KZZ_FBS ?FBS_NAME[(int)val] :FBS_MODE_NAME[(int)val]),(i%LISTOFFSET)+1,20); } else if(DBData[i] == RT1064KZZ_UAB_CH || DBData[i] == RT1064KZZ_UBC_CH || DBData[i] == RT1064_DZ_CHZCS) { sprintf(szVal, "%0.f" , val); LCD_DisString((i%LISTOFFSET)+1, 19 , szVal); if(DBData[i] == RT1064_DZ_CHZCS) LCD_DisString((i%LISTOFFSET)+1, 24, (char *)"次"); if (isDraw == 1) len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); } else { sprintf(szVal, "%0.3f" , get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])); LCD_DisString((i%LISTOFFSET)+1, 19, szVal); if (DBData[i] >= RT1064_YS_GL1 && DBData[i] <= RT1064_YS_FBS_JY) LCD_DisString((i%9)+1, 25, (char *)"S"); else if ((DBData[i] >= RT1064_DZ_GL1 && DBData[i] <= RT1064_DZ_I02) || ((DBData[i] >= RT1064_DZ_PHASE_I && DBData[i] <= RT1064_DZ_I0DLT) && DBData[i] != RT1064_DZ_YL_HAR && DBData[i] != RT1064_DZ_LMJ) || DBData[i] == RT1064_DZ_SD || DBData[i] == RT1064_DZ_I0HJS || DBData[i] == RT1064_DZ_FC_CHZ || (DBData[i] >= RT1064_DZ_I03 && DBData[i] <= RT1064_DZ_FBS_I0)|| DBData[i] == RT1064_DZ_FBS_OL) { LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"A"); } else if (DBData[i] == RT1064_DZ_LMJ || DBData[i] == RT1064_DZ_JC || DBData[i] == RT1064_DZ_GYJC) { LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"°"); } else if (DBData[i] == RT1064_DZ_YL_HAR) LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"%"); else if (DBData[i] == RT1064_DZ_IDS ||DBData[i] == RT1064_DZ_OPENCS || (DBData[i] >= RT1064_DZ_I03 && DBData[i] <= RT1064_DZ_FBS_I0)) { LCD_DisString((i%LISTOFFSET)+1, 24, (char *)"次"); } else if (DBData[i] == RT1064_DZ_DP || DBData[i] == RT1064_DZ_GP) { LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"HZ"); } else LCD_DisString((i%LISTOFFSET)+1, 25, (char *)"V"); if (isDraw == 1)len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); }

优化这段代码 if(i > num - 1) break; isDraw = (not == 2 && (draw == i+1)); if (DBData[i] != RT1064_YS_YYDD && DBData[i] != RT1064KZZ_FC_CHZ ) LCD_DisString((i%LISTOFFSET)+1, 0, gRunPara.gap_ActionDZInfo[gapid][DBData[i]].szName); if (DBData[i] == RT1064KZZ_FC_CHZ) LCD_DisString((i%LISTOFFSET)+1, 0, (char *)"大电流闭锁重合闸"); if (DBData[i] == RT1064_YS_YYDD) LCD_DisString((i%LISTOFFSET)+1, 0, (char *)"重合闸检有压时间"); val = get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i]); if( DBData[i] >= RT1064KZZ_GL1_ALM && DBData[i] <= RT1064KZZ_KZHL && DBData[i] != RT1064KZZ_MODE && DBData[i] != RT1064KZZ_UAB_CH && DBData[i] != RT1064KZZ_UBC_CH && DBData[i] != RT1064KZZ_FBS && DBData[i] != RT1064KZZ_FBS_MODE) { (isDraw ? LCD_DisString_Not((i%LISTOFFSET)+1, 20,(char *)gcszOnOff[(int)val]) : LCD_DisString((i%LISTOFFSET)+1, 20,(char *)gcszOnOff[(int)val]) ); } else if(DBData[i] == RT1064KZZ_MODE) { (isDraw ? LCD_DisString_Not((i%LISTOFFSET)+1, 20,(char *)ModeName[(int)val]) : LCD_DisString((i%LISTOFFSET)+1, 20,(char *)ModeName[(int)val]) ); } else if (DBData[i] == RT1064KZZ_FBS || DBData[i] == RT1064KZZ_FBS_MODE ) { (isDraw ? LCD_DisString_Not((i%LISTOFFSET)+1, 20,(char *)FBS_NAME[(int)val]) : LCD_DisString((i%LISTOFFSET)+1, 20,(char *)FBS_NAME[(int)val]) ); } else if(DBData[i] == RT1064KZZ_UAB_CH || DBData[i] == RT1064KZZ_UBC_CH || DBData[i] == RT1064_DZ_CHZCS) { sprintf(szVal, "%0.f" , val); LCD_DisString((i%LISTOFFSET)+1, 19 , szVal); if(DBData[i] == RT1064_DZ_CHZCS) LCD_DisString((i%LISTOFFSET)+1, 24, (char *)"次"); if (isDraw == 1) len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); }

优化这段代码 if( DBData[i] >= RT1064KZZ_GL1_ALM && DBData[i] <= RT1064KZZ_KZHL && DBData[i] != RT1064KZZ_MODE && DBData[i] != RT1064KZZ_UAB_CH && DBData[i] != RT1064KZZ_UBC_CH && DBData[i] != RT1064KZZ_FBS && DBData[i] != RT1064KZZ_FBS_MODE) { LCD_DisString((i%9)+1, 20, (char *)gcszOnOff[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)gcszOnOff[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } else if(DBData[i] == RT1064KZZ_MODE) { LCD_DisString((i%9)+1, 20, (char *)ModeName[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)ModeName[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } else if (DBData[i] == RT1064KZZ_FBS || DBData[i] == RT1064KZZ_FBS_MODE ) { if (DBData[i] == RT1064KZZ_FBS) { LCD_DisString((i%9)+1, 20, (char *)FBS_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)FBS_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } else if(DBData[i] == RT1064KZZ_FBS_MODE ) { LCD_DisString((i%9)+1, 20, (char *)FBS_MODE_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)FBS_MODE_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } } else if(DBData[i] == RT1064KZZ_UAB_CH || DBData[i] == RT1064KZZ_UBC_CH || DBData[i] == RT1064_DZ_CHZCS) { sprintf(szVal, "%0.f" , get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])); LCD_DisString((i%9)+1, 19 , szVal); if(DBData[i] == RT1064_DZ_CHZCS) LCD_DisString((i%9)+1, 24, (char *)"次"); if (not == 2) { if(draw == (i+1)) { len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); } } }

优化这段代码 if( DBData[i] >= RT1064KZZ_GL1_ALM && DBData[i] <= RT1064KZZ_KZHL && DBData[i] != RT1064KZZ_MODE && DBData[i] != RT1064KZZ_UAB_CH && DBData[i] != RT1064KZZ_UBC_CH && DBData[i] != RT1064KZZ_FBS && DBData[i] != RT1064KZZ_FBS_MODE) { LCD_DisString((i%9)+1, 20, (char *)gcszOnOff[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)gcszOnOff[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } else if(DBData[i] == RT1064KZZ_MODE) { LCD_DisString((i%9)+1, 20, (char *)ModeName[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)ModeName[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } else if (DBData[i] == RT1064KZZ_FBS || DBData[i] == RT1064KZZ_FBS_MODE ) { if (DBData[i] == RT1064KZZ_FBS) { LCD_DisString((i%9)+1, 20, (char *)FBS_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)FBS_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } else if(DBData[i] == RT1064KZZ_FBS_MODE ) { LCD_DisString((i%9)+1, 20, (char *)FBS_MODE_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); if (not == 2) { if(draw == (i+1)) { LCD_DisString_Not((i%9)+1, 20, (char *)FBS_MODE_NAME[(int)get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])]); } } } } else if(DBData[i] == RT1064KZZ_UAB_CH || DBData[i] == RT1064KZZ_UBC_CH || DBData[i] == RT1064_DZ_CHZCS) { sprintf(szVal, "%0.f" , get_ActionDZInfo_val(UNIT_GAP_RT1064,gapid,DBData[i])); LCD_DisString((i%9)+1, 19 , szVal); if(DBData[i] == RT1064_DZ_CHZCS) LCD_DisString((i%9)+1, 24, (char *)"次"); if (not == 2) { if(draw == (i+1)) { len = LCD_BitNot(UNIT_PROTECT,UNIT_GAP_RT1064,gapid,DBData[i],i,bit); } } }

sprintf(szVal, "%0.3f" , val); LCD_DisString((i%9)+1, 19, szVal); Pro_szUnit(DBData[i],i); if (isDraw == 1) val = LCD_BitModify(val,draw); ikey = Lcd_Recvfun2(); switch(ikey) { case LCD_KEY_UP: bit = 0; if (not == 2) { if (draw > page + 1 && draw <= line) draw = draw - 1; } break; case LCD_KEY_DOWN: bit = 0; if (not == 2) { if(draw < i) if (draw < line) draw = draw + 1; } break; case LCD_KEY_ADD: break; case LCD_KEY_DECREASE: break; case LCD_KEY_Left: if (not == 1) { change = 0; if(page < 9) continue; if(page >= 9) { page = page - 9; line = line - 9; } } break; case LCD_KEY_RIGHT: if (not == 1) { change = 0; if(line >= num) continue; if(page < num) { page = page + 9; line = line + 9; } } break; case LCD_KEY_ENTER: not = 2; bit = 0; break; case LCD_KEY_CANCEL: change = 0; if(not > 0) --not; draw = 0; if (not == 0) return; break; default: break; } } 这段代码中的LCD_BitModify函数也会运行ikey = Lcd_Recvfun2(); switch(ikey) { case LCD_KEY_UP: bit = 0; if (not == 2) { if (draw > page + 1 && draw <= line) draw = draw - 1; } break; case LCD_KEY_DOWN: bit = 0; if (not == 2) { if(draw < i) if (draw < line) draw = draw + 1; } break; case LCD_KEY_ADD: break; case LCD_KEY_DECREASE: break; case LCD_KEY_Left: if (not == 1) { change = 0; if(page < 9) continue; if(page >= 9) { page = page - 9; line = line - 9; } } break; case LCD_KEY_RIGHT: if (not == 1) { change = 0; if(line >= num) continue; if(page < num) { page = page + 9; line = line + 9; } } break; case LCD_KEY_ENTER: not = 2; bit = 0; break; case LCD_KEY_CANCEL: change = 0; if(not > 0) --not; draw = 0; if (not == 0) return; break; default:break; }怎么使它们互不干扰

在mysql数据里有一张表,建表语句如下: CREATE TABLE audit_bin_info ( BIN_PID int(8) NOT NULL, HOST_NAME varchar(100) DEFAULT NULL , SOCK_ID int(8) DEFAULT NULL , BIN_STS tinyint(2) DEFAULT NULL , BOOT_NAME varchar(100) DEFAULT NULL, CHANNEL_ID tinyint(2) DEFAULT NULL , START_DATE datetime DEFAULT NULL , UPDATE_DATE datetime DEFAULT NULL, MODULE_NAME varchar(100) DEFAULT NULL, BUSI_CONTENT varchar(4000) DEFAULT NULL, TASK_STS smallint(4) DEFAULT NULL , ID bigint(15) NOT NULL AUTO_INCREMENT, PRIMARY KEY (ID) USING BTREE, KEY IDX_BIN_INFO (BOOT_NAME,MODULE_NAME,CHANNEL_ID) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=16766000 DEFAULT CHARSET=utf8 帮我写一个c++的函数,函数定义如下: void CMonitorBase::binlogToDb( const AISTD string & strBinName, const AISTD string & strBinType, const CClientList & listClient, const AISTD string &m_strChannelId, otl_connect& ocDbConn) 它需求实现以下功能: 1、使用otl_stream查询audit_bin_info表,查询语句为select id, bin_pid, host_name, sock_id from audit_bin_info where boot_name='"+strBinName+"' and module_name='"+strBinType+"' and channel_id = " + m_strChannelId;将查到数据保存在一个vector结构中; 2、将查到的表数据跟listClient中的数据做比较,比较条件为表数据中的bin_pid, host_name, sock_id分别和CClient结构中的m_iAppId,m_strHostName,m_iSockId,都相等,则认为找到数据。 3、如果在listClient中找到相等的数据,则根据找到的数据update表中的数据,需要更新的字段为BIN_STS, START_DATE, BUSI_CONTENT,TASK_STS,UPDATE_DATE,前4个字段对别对应CClient结构中的m_nClientSts,dtmBoot,m_strBusiContent,m_nTaskSts,UPDATE_DATE取系统时间; 如果在listClient中没找到相等的数据,则根据id值删除audit_bin_info表中的数据; 最后如果是listClient中多出来的数据,需要插入到audit_bin_info表中; 其中CClient和CClientList的定义如下: class CClient { public: long m_idx; int32 m_iSockId; int32 m_iAppId; int64 m_llTaskId; int16 m_nTaskSts; int16 m_nClientSts; int16 m_nMaxTask; int16 m_nChannelId; AISTD string m_strBusiContent; AISTD string m_strHostName; INT64LIST m_listDetail; AISTD string m_strSpecSts; CBSDateTime dtmBoot; AISTD string m_strRetMsg; int16 m_nStatus; int16 m_nDispEsc; CClient() : m_idx(0), m_iSockId(0), m_iAppId(0), m_llTaskId(0), m_nTaskSts(0), m_nClientSts(1), m_nMaxTask(1), m_nChannelId(0), m_strSpecSts("0"), m_nStatus(0), m_nDispEsc(0) { dtmBoot = CBSDateTime::currentDateTime(); }; }; typedef AISTD vector<CClient*> CClientList;

最新推荐

recommend-type

端午送祝福语小程序源码(可对接流量主)

该小程序的作用就是祝福语生成距离端午节也不远了,可以抓住机会蹭一波流量用户可以点击直接发送祝福语给好友 分享的时候会显示用。
recommend-type

基于Springboot微服务的车联网位置信息管理软件的设计与实现+论文

基于Spring Boot微服务的车联网位置信息管理软件旨在通过现代化技术提升车辆位置信息的实时监控与管理效率。以下是该系统的功能模块和技术实现的简要介绍: 系统功能模块 车辆定位与追踪:通过集成GPS等定位技术,实时获取车辆位置信息,并提供车辆追踪功能。 位置信息管理:存储、查询、更新车辆位置信息,支持历史轨迹回放和位置数据统计分析。 报警与预警:根据预设规则,对异常位置信息进行报警和预警,如超速、越界等。 用户管理:支持用户注册、登录、权限管理等操作,确保系统安全和数据保密。 技术实现 后端技术:采用Spring Boot框架构建微服务架构,利用Maven进行项目管理,确保系统的高性能和稳定性。 数据库:使用MySQL数据库存储车辆位置信息、用户数据等关键信息,支持高效的数据查询和统计分析。 定位技术:集成GPS等定位技术,实现车辆位置的实时获取和追踪。 前端技术:结合Vue.js等前端框架,构建直观、友好的用户界面,提供丰富的交互体验。 该系统通过Spring Boot微服务架构和现代化技术,实现了车联网位置信息的实时监控与管理,为车辆管理提供了有力的技术支持。
recommend-type

毕业设计MATLAB_SIFT特征提取.zip

毕业设计MATLAB_SIFT特征提取.zip
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

MATLAB柱状图在信号处理中的应用:可视化信号特征和频谱分析

![matlab画柱状图](https://img-blog.csdnimg.cn/3f32348f1c9c4481a6f5931993732f97.png) # 1. MATLAB柱状图概述** MATLAB柱状图是一种图形化工具,用于可视化数据中不同类别或组的分布情况。它通过绘制垂直条形来表示每个类别或组中的数据值。柱状图在信号处理中广泛用于可视化信号特征和进行频谱分析。 柱状图的优点在于其简单易懂,能够直观地展示数据分布。在信号处理中,柱状图可以帮助工程师识别信号中的模式、趋势和异常情况,从而为信号分析和处理提供有价值的见解。 # 2. 柱状图在信号处理中的应用 柱状图在信号处理
recommend-type

帮我设计一个基于Android平台的便签APP的代码

很抱歉,我是一个语言模型AI,无法提供完整的Android APP代码。但是,我可以给您一些设计便签APP的建议和思路。 1. 界面设计 首先考虑APP的界面设计,便签APP通常需要一个主界面用于显示所有的便签,以及一个编辑界面用于编辑单个便签。主界面可以采用列表的形式,列出所有的便签,每个便签可以显示标题和摘要内容。在编辑界面中,用户可以输入标题和正文内容,并且可以设置提醒时间、标签、优先级等。 2. 数据存储 便签APP需要一个数据存储的方案,可以考虑使用SQLite数据库来存储便签数据。每个便签可以存储标题、正文内容、提醒时间、标签、优先级等信息。 3. 便签操作 便签APP
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

MATLAB柱状图在数据分析中的作用:从可视化到洞察

![MATLAB柱状图在数据分析中的作用:从可视化到洞察](https://img-blog.csdnimg.cn/img_convert/1a36558cefc0339f7836cca7680c0aef.png) # 1. MATLAB柱状图概述** 柱状图是一种广泛用于数据可视化的图表类型,它使用垂直条形来表示数据中不同类别或组别的值。在MATLAB中,柱状图通过`bar`函数创建,该函数接受数据向量或矩阵作为输入,并生成相应的高度条形。 柱状图的优点在于其简单性和易于理解性。它们可以快速有效地传达数据分布和组别之间的比较。此外,MATLAB提供了广泛的定制选项,允许用户调整条形颜色、