-
Notifications
You must be signed in to change notification settings - Fork 2
/
db-intf.h
86 lines (69 loc) · 1.24 KB
/
db-intf.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef DB_INTF_H
#define DB_INTF_H 1
#include <string>
#include <vector>
typedef enum {
DBT_INTEGER = 1,
DBT_FLOAT = 2,
DBT_BLOB = 4,
DBT_NULL = 5,
DBT_TEXT = 3
} DB_FIELD_TYPE;
/**
*/
class DatabaseIntf
{
public:
bool isOpen;
std::string type;
std::string errmsg;
DatabaseIntf() : isOpen(false) {};
virtual ~DatabaseIntf() {};
virtual int open(
const std::string &connection,
const std::string &login,
const std::string &password,
const std::string &db,
int port
) = 0;
virtual int close() = 0;
virtual int exec(
const std::string &statement
) = 0;
virtual int select(
std::vector<std::vector<std::string> > &retval,
const std::string &statement
) = 0;
// cursor
virtual int cursorOpen(
void **retStmt,
std::string &statement
) = 0;
virtual int cursorBindText(
void *stmt,
int position1,
const std::string &value
) = 0;
virtual int cursorColumnCount(
void *stmt
) = 0;
virtual std::string cursorColumnName(
void *stmt,
int column0
) = 0;
virtual std::string cursorColumnText(
void *stmt,
int column0
) = 0;
virtual DB_FIELD_TYPE cursorColumnType(
void *stmt,
int column0
) = 0;
virtual bool cursorNext(
void *stmt
) = 0;
virtual int cursorClose(
void *stmt
) = 0;
};
#endif