-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
82 lines (61 loc) · 1.91 KB
/
Copy pathmain.cpp
File metadata and controls
82 lines (61 loc) · 1.91 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<iostream>
#include<string>
#include<stdio.h>
#include<cstring>
#include"head.h"
using namespace std;
int main()
{
char input[MAXLEN];
char *secondinput;//作为二级输入的指针进行储存
string judge;//作为判断第一个关键词的词储存
char first[MAXLEN];
string firstjudge;//决定是否进去
cout<<"~$ ";
cin>>first;//这是作为进入的判定
firstjudge = first;
firstjudge = Upper(firstjudge);
if (firstjudge != "MYSQL")
{
cout<<"无法进入"<<endl;
return 0;
}
getchar();
cout<<"Welcome mySQL by GRP"<<endl;
Data_Table data_table;
cout<<"(mySQL)==> 初始化"<<std::endl;
data_table.ini();
do
{
cout<<"(mySQL)==>";
cin.getline(input, MAXLEN, '\n');//默许的输入语句长度为1000;
//cout<<input<<endl;//作为调试的语句
secondinput = OrderDivide(input,' ',1);
judge = input;
judge = Upper(judge);
//cout<<judge<<endl;
if (judge == "CREATE")
data_table.create(secondinput);
else if (judge == "DROP")
data_table.drop(secondinput);
else if (judge == "TABLE")
data_table.table_list(secondinput);
else if (judge == "INSERT")
data_table.insert(secondinput);
else if (judge == "DELETE")
data_table.my_delete(secondinput);
else if (judge == "UPDATE")
data_table.update(secondinput);
else if (judge == "SELECT")
data_table.select(secondinput);
else if (judge == "COMPUTE")
data_table.compute(secondinput);
else if (judge == "SEARCH")
data_table.search(secondinput);
else if (judge != "QUIT")
cout<<"语法错误!"<<endl;
}while (strcmp(input,"quit") != 0);
cout<<"~$ quit"<<endl;
//getchar();getchar();
return 0;
}