-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdbdo.h
70 lines (54 loc) · 1.04 KB
/
dbdo.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
66
67
68
69
70
/*
* dbdo.h
*
* Created on: 2012-12-6
* Author: zsg
*/
#ifndef DBDO_H_
#define DBDO_H_
#undef max
#undef min
#include <string>
using namespace std;
#include "api.h"
typedef struct
{
MYSQL *conn;
MYSQL_ROW row;
MYSQL_RES *result;
unsigned long m;
pthread_cond_t *cond;
pthread_mutex_t *mut;
}TDB;
class Cdbdo
{
public:
Cdbdo();
virtual ~Cdbdo();
bool DataBaseIni();
void loaddb(INFO_MAP * mapinfo);
bool BBT_DOSQL(const char *psql);
void BBT_DisConn();
void getdb (void * t);
public:
TDB pdb;
MYSQL *conn;
#ifdef MULTI_THREAD
pthread_mutex_t mut;
pthread_cond_t cond;
#endif
private:
bool readConfigFile();
MYSQL_RES * getResult(const char* sqlstr, bool *boolresult);
bool checklink();
private:
INFO_MAP *m_mapinfo;
string m_strServerName;
string m_strUserName;
string m_strPassword;
string m_strDBName;
int m_port;
string configFilename;
std::map<string,string> kvmap;
};
#endif /* DBDO_H_ */