BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
db_mysql.h
Go to the documentation of this file.
1#ifndef DB_MYSQL_CLASS_H
2#define DB_MYSQL_CLASS_H
3
4#include <mysql.h>
5#include <string>
6#include <iostream>
7using namespace std;
8#define NEXT_ROW -1
10{
11private:
12 MYSQL *m_Mysql;
13 MYSQL_RES *m_Res;
14 MYSQL_ROW m_Row;
15 MYSQL_FIELD *m_field;
16
17 string m_strHost;
18 string m_strUser;
19 string m_strPasswd;
20 string m_strDB;
21 string m_strQuery;
22
23
24 bool m_bInit;
25 bool m_bConnect;
26 bool m_bSelectDB;
27 bool m_bExecute;
28 bool m_bGetRow;
29 bool m_result; //zhaohs
30//Constructors:
31public:
32 db_mysql();
33 db_mysql(string host,string user,string passwd,string db="");
34 ~db_mysql();
35
36 unsigned int Field_num;
37//functions:
38 void Init(string host,string user,string passwd,string db="");
39 void SetQuery(string query);
40 bool Connect(void);
41 bool SelectDB(string db);
42
43 bool Execute(string query="");
44 unsigned long Num_Rows(void);
45
46 bool GetRow(my_ulonglong row=NEXT_ROW);
47 string GetField(unsigned int n);
48 string GetField_name(unsigned int n);
49 //string GetField(string name);
50 //string GetField_name(string name);
51
52 void Free_Result(void);
53 void Close(void);
54
55};
56#endif
const Int_t n
struct st_mysql_res MYSQL_RES
struct st_mysql MYSQL
void Free_Result(void)
Definition db_mysql.cpp:213
bool SelectDB(string db)
Definition db_mysql.cpp:79
bool GetRow(my_ulonglong row=NEXT_ROW)
Definition db_mysql.cpp:133
string GetField_name(unsigned int n)
Definition db_mysql.cpp:183
unsigned long Num_Rows(void)
Definition db_mysql.cpp:203
void SetQuery(string query)
Definition db_mysql.cpp:37
void Close(void)
Definition db_mysql.cpp:223
void Init(string host, string user, string passwd, string db="")
Definition db_mysql.cpp:25
bool Connect(void)
Definition db_mysql.cpp:41
bool Execute(string query="")
Definition db_mysql.cpp:96
unsigned int Field_num
Definition db_mysql.h:36
string GetField(unsigned int n)
Definition db_mysql.cpp:160
#define NEXT_ROW
Definition db_mysql.h:8