81 lines
3.1 KiB
C++
81 lines
3.1 KiB
C++
/**
|
|
@file RtdbOperate.h
|
|
@brief 内存表操作类
|
|
@author 曹顶法
|
|
*/
|
|
#pragma once
|
|
#include "rdb_api/CRdbAccessEx.h"
|
|
#include "NodeMngCommon.h"
|
|
#include "sys_node_mng_api/SysRunRedundantInfoTable.h"
|
|
#include "sys_node_mng_api/SysRunRedundantCmdTable.h"
|
|
#include "sys_proc_mng_api/SysRunAppInfoTable.h"
|
|
|
|
namespace kbd_sys
|
|
{
|
|
class CRdbOperate
|
|
{
|
|
public:
|
|
CRdbOperate();
|
|
virtual ~CRdbOperate();
|
|
|
|
/**
|
|
@brief 初始化
|
|
@return 成功返回kbdSuccess,失败返回kbdFailed
|
|
*/
|
|
int initialize();
|
|
/**
|
|
@brief 删除表sys_run_redundancy_cmd记录
|
|
@param const SRunRedundantCmdKey & stKey 主键
|
|
@return 成功返回kbdSuccess,失败返回kbdFailed
|
|
*/
|
|
int deleteFromRedundancyCmd(const SRunRedundancyCmdKey &stKey);
|
|
/**
|
|
@brief 表sys_run_redundancy_cmd中增加记录
|
|
@param const SRunRedundancyCmd & stRecord 要增加的记录
|
|
@param const bool bDelBeforeInsert insert前是否先delete
|
|
@return 成功返回kbdSuccess,失败返回kbdFailed
|
|
*/
|
|
int insertToRedundancyCmd(const SRunRedundancyCmd &stRecord, const bool bDelBeforeInsert);
|
|
/**
|
|
@brief 表sys_run_redundancy_info中增加记录
|
|
@param const SRunRedundancyInfo & stRecord 要增加的记录
|
|
@param const bool bDelBeforeInsert insert前是否先delete
|
|
@return 成功返回kbdSuccess,失败返回kbdFailed
|
|
*/
|
|
int insertToRedundancyInfo(const SRunRedundancyInfo &stRecord, const bool bDelBeforeInsert);
|
|
/**
|
|
@brief 更新表sys_run_redundancy_info记录
|
|
@param const SRunRedundancyInfoKey & stKey 主键
|
|
@param std::vector<kbd_dbms::RSQL_UPD_COLUMN> vecCol 要更新的字段
|
|
@return 成功返回kbdSuccess,失败返回kbdFailed
|
|
*/
|
|
int updateRedundancyInfo(const SRunRedundancyInfoKey &stKey, std::vector<kbd_dbms::RSQL_UPD_COLUMN> vecCol);
|
|
/**
|
|
@brief 获取表sys_run_app_info指定记录信息
|
|
@param const STableRunAppInfoKey & stAppInfoKey 主键
|
|
@param STableRunAppInfo & stRunAppInfo 返回的记录
|
|
@return 成功返回kbdSuccess,失败返回kbdFailed
|
|
*/
|
|
int getLocalRunAppInfo(const STableRunAppInfoKey &stAppInfoKey, STableRunAppInfo &stRunAppInfo);
|
|
|
|
private:
|
|
/**
|
|
@brief 清理表中所有数据并关闭
|
|
@return 成功返回kbdSucess,失败返回错误码
|
|
*/
|
|
void cleanAndCloseAllTable();
|
|
|
|
private:
|
|
kbd_dbms::CRdbAccessEx m_objRunRedundancyCmdTable; //< sys_run_redundancy_cmd表
|
|
boost::mutex m_objRedundancyCmdMutex; //< sys_run_redundancy_cmd互斥量
|
|
|
|
kbd_dbms::CRdbAccessEx m_objRunRedundancyInfoTable; //< sys_run_redundancy_info表
|
|
boost::mutex m_objRedundancyInfoMutex; //< sys_run_redundancy_info互斥量
|
|
|
|
kbd_dbms::CRdbAccessEx m_objRunAppInfoTable; //< sys_run_app_info表
|
|
boost::mutex m_objAppInfoMutex; //< sys_run_app_info互斥量
|
|
};
|
|
|
|
typedef boost::shared_ptr<CRdbOperate> CRdbOperatePtr;
|
|
}//namespace kbd_sys
|