-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMysqlDb.h
56 lines (42 loc) · 1.16 KB
/
CMysqlDb.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
/*
* Copyright (c) 2012 Alexandros Nikolopoulos <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef CMysqlDb_H_
#define CMysqlDb_H_
#include "fpd.h"
#include "tinyxml/tinyxml2.h"
#include <iostream>
#include <string>
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
using namespace std;
#define INSERT_PER_QUERY 10
class CMysqlDb : public COutput
{
public:
CMysqlDb(map<string, string> settings);
virtual ~CMysqlDb();
// Database connection functions
int Connect(void);
// Database insertion functions
int Insert(DataContainer &Data);
int Insert(DataContainerList &DataList);
int Restore(DataContainer &Data) {return false;};
// Restore multiple rows
int Restore(DataContainerList &DataList, unsigned int maxRows) {return false;};
private:
pthread_mutex_t queryMutex;
MYSQL m_conn;
string m_host;
uint16_t m_port;
string m_user;
string m_pass;
string m_db;
string m_table;
};
#endif /* CMysqlDb_H_ */