-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbms_info.cc
83 lines (80 loc) · 2.8 KB
/
dbms_info.cc
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
#include "dbms_info.hh"
dbms_info::dbms_info(map<string,string>& options)
{
if (false) {}
#ifdef HAVE_LIBSQLITE3
else if (options.count("sqlite")) {
dbms_name = "sqlite";
test_port = 0; // no port
test_db = options["sqlite"];
can_trigger_error_in_txn = true;
}
#endif
#ifdef HAVE_TIDB
else if (options.count("tidb-db") && options.count("tidb-port")) {
dbms_name = "tidb";
test_port = stoi(options["tidb-port"]);
test_db = options["tidb-db"];
can_trigger_error_in_txn = true;
}
#endif
#ifdef HAVE_MYSQL
else if (options.count("mysql-db") && options.count("mysql-port")) {
dbms_name = "mysql";
test_port = stoi(options["mysql-port"]);
test_db = options["mysql-db"];
can_trigger_error_in_txn = true;
}
#endif
#ifdef HAVE_MARIADB
else if (options.count("mariadb-db") && options.count("mariadb-port")) {
dbms_name = "mariadb";
test_port = stoi(options["mariadb-port"]);
test_db = options["mariadb-db"];
can_trigger_error_in_txn = true;
}
#endif
#ifdef HAVE_OCEANBASE
else if (options.count("oceanbase-db") && options.count("oceanbase-port")) {
dbms_name = "oceanbase";
test_port = stoi(options["oceanbase-port"]);
test_db = options["oceanbase-db"];
can_trigger_error_in_txn = true;
}
#endif
#ifdef HAVE_MONETDB
else if (options.count("monetdb-db") && options.count("monetdb-port")) {
dbms_name = "monetdb";
test_port = stoi(options["monetdb-port"]);
test_db = options["monetdb-db"];
can_trigger_error_in_txn = false;
}
#endif
else if (options.count("clickhouse-db") && options.count("clickhouse-port")) {
dbms_name = "clickhouse";
test_port = stoi(options["clickhouse-port"]);
test_db = options["clickhouse-db"];
can_trigger_error_in_txn = false;
}
else if (options.count("cockroach-db") && options.count("cockroach-port")) {
dbms_name = "cockroach";
test_port = stoi(options["cockroach-port"]);
test_db = options["cockroach-db"];
can_trigger_error_in_txn = false;
}
else if (options.count("postgres-db") && options.count("postgres-port")) {
dbms_name = "postgres";
test_port = stoi(options["postgres-port"]);
test_db = options["postgres-db"];
can_trigger_error_in_txn = false;
}
else {
cerr << "Sorry, you should specify a dbms and its database, or your dbms is not supported" << endl;
throw runtime_error("Does not define target dbms and db");
}
if (options.count("output-or-affect-num"))
ouput_or_affect_num = stoi(options["output-or-affect-num"]);
else
ouput_or_affect_num = 0;
return;
}