-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdriver.cpp
More file actions
31 lines (26 loc) · 775 Bytes
/
driver.cpp
File metadata and controls
31 lines (26 loc) · 775 Bytes
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
#include "common/Config.hpp"
#include "core/Database.hpp"
#include "core/DatabaseConfig.hpp"
#include "query/result/QueryResultCollection.hpp"
#include "util/Utility.hpp"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv)
{
if(argc != 2) {
cout << "usage: ./bin/driver [query-file]" << endl;
return -1;
}
cout << "creating swap file .. " << flush;
if(!dbi::util::createFile("bin/swap_file", 512 * dbi::kPageSize)) {
cout << "failed" << endl;
return -1;
}
cout << "done =)" << endl;
dbi::Database db(dbi::DatabaseConfig{"bin/swap_file", 256}, true);
string query = dbi::util::loadFileToMemory(argv[1]);
auto result = db.executeQuery(query);
result->print(cout);
return 0;
}