diff --git a/src/lib/Statement.cpp b/src/lib/Statement.cpp index 9ca28de..4b5ac65 100644 --- a/src/lib/Statement.cpp +++ b/src/lib/Statement.cpp @@ -1,13 +1,15 @@ /* - * Statement.c + * Statement.cpp * Implementation of functions used to build the syntax tree. */ #include "Statement.h" #include -Statement::Statement(EStatementType type) : type(type) {}; +Statement::Statement(EStatementType type) : type(type) { -SelectStatement::SelectStatement() : Statement(eSelect) {}; +}; -TableRef::TableRef(ETableRefType type) : type(type) {}; +SelectStatement::SelectStatement() : Statement(eSelect) { + +}; \ No newline at end of file diff --git a/src/lib/Statement.h b/src/lib/Statement.h index c0a0b84..e24a9a9 100644 --- a/src/lib/Statement.h +++ b/src/lib/Statement.h @@ -7,8 +7,7 @@ #include "Expr.h" #include "List.h" - -class TableRef; +#include "Table.h" typedef enum { eSelect, @@ -18,17 +17,14 @@ typedef enum { } EStatementType; - -class Statement { -public: +struct Statement { Statement(EStatementType type); EStatementType type; }; -class SelectStatement : public Statement { -public: +struct SelectStatement : Statement { SelectStatement(); TableRef* from_table; @@ -38,24 +34,17 @@ public: }; -/** - * TableRef - * Holds reference to tables. Can be either table names or a select statement. - */ -typedef enum { - eTableName, - eTableSelect -} ETableRefType; - -class TableRef { -public: - TableRef(ETableRefType type); - - ETableRefType type; - - SelectStatement* stmt; - List* table_names; - +struct DeleteStatement : Statement { + // TODO }; +struct InsertStatement : Statement { + // TODO +}; + +struct CreateStatement : Statement { + // TODO +}; + + #endif // __STATEMENT_H__ diff --git a/src/lib/Table.h b/src/lib/Table.h new file mode 100644 index 0000000..2bbd0a9 --- /dev/null +++ b/src/lib/Table.h @@ -0,0 +1,26 @@ +#ifndef __TABLEREF_H_ +#define __TABLEREF_H_ + +class SelectStatement; + +/** + * TableRef + * Holds reference to tables. Can be either table names or a select statement. + */ +typedef enum { + eTableName, + eTableSelect +} ETableRefType; + + +struct TableRef { + TableRef(ETableRefType type) : type(type) {} + + ETableRefType type; + SelectStatement* stmt; + List* table_names; +}; + + + +#endif diff --git a/src/sql_tests.cpp b/src/sql_tests.cpp index dabe58f..0e7da57 100644 --- a/src/sql_tests.cpp +++ b/src/sql_tests.cpp @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) { SelectTest2(); SelectTest3(true); ThreadSafeTest(10, 1000); - Benchmark1(500000); + Benchmark1(10000); printf("\n## Finished running all tests...\n"); printf("######################################\n");