-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathql_Manager.cpp
More file actions
65 lines (50 loc) · 1.22 KB
/
ql_Manager.cpp
File metadata and controls
65 lines (50 loc) · 1.22 KB
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
#include "ql_Manager.h"
ql_Manager::ql_Manager()
{
}
void ql_Manager::run(string q_line)
{
q_line = Praser::toLowerString(q_line);
try {
getStanderString(q_line);
}
catch (std::exception e) {
std::cerr << e.what() << std::endl;
}
if (Praser::toLowerString(q_line.substr(0, 6)) == "select") {
ql_select qsl(q_line);
qsl.run();
}
else if (Praser::toLowerString(q_line.substr(0, 6)) == "create") {
ql_create qsl(q_line);
qsl.run();
}
else if (Praser::toLowerString(q_line.substr(0, 6)) == "insert") {
ql_insert qsl(q_line);
qsl.run();
}
else if (Praser::toLowerString(q_line.substr(0, 6)) == "update") {
ql_update qsl(q_line);
qsl.run();
}
else if (Praser::toLowerString(q_line.substr(0, 6)) == "delete") {
}
else {
std::cerr << q_line.substr(0, 6) << "¸½½üÓÐÓï·¨´íÎó" << std::endl;
}
}
void ql_Manager::getStanderString(string & q_line) throw (std::exception)
{
if (q_line == "" || q_line == ";") {
throw ex_sql_empty;
}
q_line = Praser::trim(q_line);
if (q_line == "") throw ex_sql_empty;
q_line = Praser::mergeSpaces(q_line);
if (q_line == "") throw ex_sql_empty;
if (*q_line.rbegin() == ';') q_line.pop_back();
if (q_line == "") throw ex_sql_empty;
}
ql_Manager::~ql_Manager()
{
}