## DB操作的代理线程服务
#ifndef CDBPROXYTHREAD_H
#define CDBPROXYTHREAD_H
#include "baseThread.h"
#include "my_sql.h"
#include "mysqldb.h"
#include <vector>
/**************************************************************************************************
* 1. Describe One DB Action in details.
**************************************************************************************************/
class DBAction
{
public:
typedef enum _actType
{
E_ADD,
E_DELETE,
E_UPDATE,
E_SELECT
}ACT_TYPE;
DBAction(ACT_TYPE _type ,string _action,string _tbName)
{
type = _type;
action = _action;
tbName = _tbName;
}
ACT_TYPE type;
string action;
string tbName;
};
/**************************************************************************************************
* One Request Maybe Contains servaral DBAction.
**************************************************************************************************/
class CDBRequest
{
public:
CDBRequest()
{
this->type = 0;
this->actionList.clear();
}
CDBRequest(const CDBRequest & other)
{
this->type = other.type;
this->actionList = other.actionList;
}
CDBRequest(int _type)
{
type = _type;
}
void addAction(DBAction action)
{
actionList.push_back(action);
}
void cleanAction()
{
actionList.clear();
}
public:
vector<DBAction> actionList;
int type;
};
/**************************************************************************************************
* Define the Db Action Search.
**************************************************************************************************/
typedef list<CDBRequest> TaskList;
class HandleDbActionThre