-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (46 loc) · 1.39 KB
/
main.cpp
File metadata and controls
49 lines (46 loc) · 1.39 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
#include <filesystem>
#include <iostream>
#include <memory>
#include <string>
#include <signal.h>
#include "catalog/options.hpp"
#include "common/logging.hpp"
#include "instance/instance.hpp"
#include "common/printstack.hpp"
void handler(int sig) {
::signal(sig, SIG_DFL); // exit normally
std::cout << wing::get_stack_trace() << std::endl;
::raise(sig);
}
int main(int argc, char** argv) {
signal(SIGSEGV, &handler);
signal(SIGABRT, &handler);
wing::WingOptions options;
for (int i = 2; i < argc; i++) {
// Use JIT.
if (strcmp(argv[i], "--jit") == 0) {
options.exec_options.style = "jit";
} else if (strcmp(argv[i], "--vec") == 0) {
options.exec_options.style = "vec";
} else if (strcmp(argv[i], "--volcano") == 0) {
options.exec_options.style = "volcano";
}
// Create a new empty DB.
else if (strcmp(argv[i], "--new") == 0) {
std::filesystem::remove(argv[1]);
} else {
std::cerr << "Unrecognized cmdline option: " << argv[i] << std::endl;
return -1;
}
}
if (argc < 2) {
std::cerr << "Expect file name." << std::endl;
return -1;
}
if (argv[1][0] == '-' || argv[1][0] == '\0') {
std::cerr << "Warning: please check your file name." << std::endl;
std::cerr << fmt::format("Your file name is {}", argv[1]) << std::endl;
}
auto db = std::make_unique<wing::Instance>(argv[1], options);
db->ExecuteShell();
}