Repository navigation
Expand file tree
/
Copy pathDBMS.h
More file actions
78 lines (66 loc) · 1.91 KB
/
Copy pathDBMS.h
File metadata and controls
78 lines (66 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
/*
* File: DBMS.h
* Author: Administrator
*
* Created on 2012年10月15日, 下午2:49
*/
#ifndef DBMS_H
#define DBMS_H
#include <direct.h>
#include <iostream>
#include <fstream>
#include <io.h>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include "myh.h"
#define NOTUSE 1
#define TABLEEXISTED 2
#define NOTEXIST 3
#define DBEXISTED 4
#define UNKNOWN 5
#define maxReadSize 200 //max read piece
using namespace std;
class DBMS {
public:
DBMS();
DBMS(const DBMS& orig);
virtual ~DBMS();
string Replace(string src, string symbol, string r);
string GetWholeName(string suffix);
bool IsDigit(string str);
string Parse(string words);
void SetDirPath(string path);
void ParseSelect(string sentence, vector<string>& attribute,
vector<string>& table, vector<string>& condition);
void GetTableInfo(string tableName, int temp);
void ReadModel(string modelPath, string& content);
void WriteModel(string& content, int mode);
void Compare(int processed, string tableName, vector<string>& col,
vector<string>& op, vector<string>& value);
int CreateDatabase(string databaseName);
int DropDatabase(string databaseName);
void ShowDatabases();
void Use(string databaseName);
int CreateTable(string sentence);
int DropTable(string tableName);
void Describe(string tableName);
void ShowTables();
void Select(string sentence);
void Projection(string filePath, vector<string>& attribute);
void Insert(string words);
void Equi_Join(char* tableName1, char* tableName2, char* Col1, char* Col2);
void Display();
private:
string dirPath;
string currentDb;
string currentTable;
vector<string> column;
vector<int> size; //
vector<int> type; //0-char 1-int
vector<int> position;
vector<int> key;
int tupleLength;
};
#endif /* DBMS_H */