-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmysqlProcess.h
65 lines (50 loc) · 1.35 KB
/
mysqlProcess.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef MYSQLPROCESS_H
#define MYSQLPROCESS_H
#include <fcntl.h>
#include <mysql/mysql.h>
#include <errno.h>
#include "config.h"
#include "log.h"
#include "myconvert.h"
#include "util.h"
class MysqlProcess
{
public:
MysqlProcess();
~MysqlProcess();
/*
*@todo 连接数据库
*/
int Connect();
/*
*@todo 断开数据库连接
*/
int DisConnect();
/*
*@todo 保持数据库连接
*/
int KeepAlive();
/*
*@todo 判断与mysql交互的协议是否启用了checksum,mysql5.6新加入checksum机制
*/
bool CheckIsChecksumEnable();
/*
*@todo 获取到数据库中binlog的最新位置
*@param szBinlogFileName binlog文件名
*@param puBinlogPos binlog文件的偏移量
*/
int GetNowBinlogPos(string &sBinlogFileName, uint32_t &uBinlogPos);
/*
*@todo 获取mysql的文件描述符
*/
int GetFd();
/*
*@todo 向数据库服务器发送数据报,请求服务器将binlog发过来
*/
int ReqBinlog(string &sBinlogFileName, uint32_t uBinlogPos, bool bChecksumEnable);
private:
MYSQL m_mysql;
time_t m_tLastKeepAliveTime;
bool m_bConnected;
};
#endif