-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysql.hh
61 lines (48 loc) · 1.57 KB
/
mysql.hh
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
#ifndef MYSQL_HH
#define MYSQL_HH
extern "C" {
#include <mysql/mysql.h>
}
#include "schema.hh"
#include "relmodel.hh"
#include "dut.hh"
#include <sys/time.h> // for gettimeofday
#define MYSQL_STMT_BLOCK_MS 100
struct mysql_connection {
MYSQL mysql;
string test_db;
unsigned int test_port;
mysql_connection(string db, unsigned int port);
~mysql_connection();
};
struct schema_mysql : schema, mysql_connection {
schema_mysql(string db, unsigned int port);
virtual void update_schema();
virtual std::string quote_name(const std::string &id) {
return id;
}
};
struct dut_mysql : dut_base, mysql_connection {
virtual void test(const string &stmt,
vector<vector<string>>* output = NULL,
int* affected_row_num = NULL,
vector<string>* env_setting_stmts = NULL);
virtual void reset(void);
virtual void backup(void);
virtual void reset_to_backup(void);
virtual string commit_stmt();
virtual string abort_stmt();
virtual string begin_stmt();
virtual void get_content(vector<string>& tables_name, map<string, vector<vector<string>>>& content);
virtual string get_process_id();
static pid_t fork_db_server();
dut_mysql(string db, unsigned int port);
static int save_backup_file(string testdb, string path);
void block_test(const string &stmt, vector<vector<string>>* output = NULL, int* affected_row_num = NULL);
bool check_whether_block(vector<unsigned long>& blocking_tids);
bool has_sent_sql;
string sent_sql;
bool txn_abort;
unsigned long thread_id;
};
#endif