2014-10-09 01:30:22 +02:00
|
|
|
/*
|
|
|
|
* Statement.h
|
|
|
|
* Definition of the structure used to build the syntax tree.
|
|
|
|
*/
|
|
|
|
#ifndef __STATEMENT_H__
|
|
|
|
#define __STATEMENT_H__
|
2014-10-20 22:33:36 +02:00
|
|
|
|
2014-10-09 04:09:47 +02:00
|
|
|
#include "Expr.h"
|
2014-10-09 01:30:22 +02:00
|
|
|
#include "List.h"
|
2014-10-22 17:42:05 +02:00
|
|
|
#include "Table.h"
|
2014-10-09 01:30:22 +02:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eSelect,
|
|
|
|
eDelete,
|
|
|
|
eInsert,
|
|
|
|
eCreate
|
|
|
|
} EStatementType;
|
|
|
|
|
|
|
|
|
2014-10-22 17:42:05 +02:00
|
|
|
struct Statement {
|
2014-10-24 16:51:49 +02:00
|
|
|
Statement(EStatementType type) : type(type) {};
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2014-10-20 22:33:36 +02:00
|
|
|
EStatementType type;
|
2014-10-09 01:30:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-10-22 17:42:05 +02:00
|
|
|
struct SelectStatement : Statement {
|
2014-10-24 16:51:49 +02:00
|
|
|
SelectStatement() : Statement(eSelect) {};
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2014-10-20 22:33:36 +02:00
|
|
|
TableRef* from_table;
|
|
|
|
List<Expr*>* select_list;
|
|
|
|
List<Expr*>* group_by;
|
|
|
|
Expr* where_clause;
|
2014-10-09 01:30:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-10-22 17:42:05 +02:00
|
|
|
struct DeleteStatement : Statement {
|
|
|
|
// TODO
|
|
|
|
};
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2014-10-22 17:42:05 +02:00
|
|
|
struct InsertStatement : Statement {
|
|
|
|
// TODO
|
|
|
|
};
|
2014-10-09 01:30:22 +02:00
|
|
|
|
2014-10-22 17:42:05 +02:00
|
|
|
struct CreateStatement : Statement {
|
|
|
|
// TODO
|
2014-10-09 01:30:22 +02:00
|
|
|
};
|
2014-10-20 22:33:36 +02:00
|
|
|
|
2014-10-22 17:42:05 +02:00
|
|
|
|
2014-10-20 22:33:36 +02:00
|
|
|
#endif // __STATEMENT_H__
|