usql/executor.h

35 lines
895 B
C++

#pragma once
#include "parser.h"
#include "table.h"
#include <string>
class Executor {
private:
public:
Executor();
bool execute(Node& node);
private:
bool execute_create_table(CreateTableNode& node);
bool execute_insert_into_table(InsertIntoTableNode& node);
bool execute_select(SelectFromTableNode& node);
Table* find_table(const std::string name);
private:
std::vector<Table> m_tables;
bool evalWhere(const SelectFromTableNode &node, Table *table,
std::vector<Row, std::allocator<Row>>::iterator &row) const;
std::unique_ptr<Node>
evalNode(Table *table, std::vector<Row, std::allocator<Row>>::iterator &row,
Node *filter) const;
bool evalRelationalOperator(const RelationalOperatorNode &filter, Table *table,
std::vector<Row, std::allocator<Row>>::iterator &row) const;
};