-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
47 lines (43 loc) · 950 Bytes
/
main.cpp
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
//
// main.cpp
// MiniSQL
//
// Created by 顾秀烨 on 10/12/15.
// Copyright © 2015 laoreja. All rights reserved.
//
#include <iostream>
#include <string.h>
#include "BufferManager.hpp"
#include "BlockForBuffer.hpp"
#include "RecordManager.hpp"
#include "IndexManager.h"
#include "API.h"
#include "CatalogManager.h"
#include "Interpreter.h"
//for test
BufferManager bm = BufferManager();
int main(int argc, const char * argv[]) {
RecordManager rm;
IndexManager im;
API api;
CatalogManager cm;
Interpreter it(std::cin,std::cout,&cm);
api.rm = &rm;
api.im = &im;
api.cm = &cm;
im.SetBuffer(bm);
cm.SetBuffer(bm);
if(argc>1&&strcmp(argv[1], "init") == 0){
cm.InitFromEmpty();
im.InitFromEmpty();
}
else {
//cm.InitFromEmpty();
//im.InitFromEmpty();
im.InitFromFile();
cm.InitFromFile();
}
it.api = &api;
it.run();
return 0;
}