another bit of refactoring
This commit is contained in:
11
main.cpp
11
main.cpp
@@ -1,5 +1,5 @@
|
||||
#include "parser.h"
|
||||
#include "executor.h"
|
||||
#include "usql.h"
|
||||
|
||||
// https://dev.to/joaoh82/what-would-sqlite-look-like-if-written-in-rust-part-1-2np4
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
// drop table
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
usql::Parser parser{};
|
||||
usql::Executor executor{};
|
||||
|
||||
std::vector<std::string> sql_commands{
|
||||
"create table a (i integer not null, s varchar(64), f float null)",
|
||||
"insert into a (i, s) values(1, 'one')",
|
||||
@@ -35,13 +32,13 @@ int main(int argc, char *argv[]) {
|
||||
};
|
||||
|
||||
|
||||
usql::uSQL uSql{};
|
||||
|
||||
for (auto command : sql_commands) {
|
||||
std::cout << command << std::endl;
|
||||
auto node = parser.parse(command);
|
||||
auto result = executor.execute(*node);
|
||||
auto result = uSql.execute(command);
|
||||
|
||||
result->print();
|
||||
// std::cout << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user