added object members for having, limit, order

This commit is contained in:
Pedro 2014-10-27 11:48:55 +01:00
parent f319a02a85
commit ef716ec742
2 changed files with 28 additions and 2 deletions

View File

@ -157,6 +157,10 @@ select_statement:
s->from_table = $3;
s->where_clause = $4;
s->group_by = $5;
s->having = NULL; // TODO
s->order = NULL; // TODO
s->limit = kNoLimit; // TODO
s->offset = kNoOffset; // TODO
$$ = s;
}
;

View File

@ -9,6 +9,7 @@
#include "List.h"
#include "Table.h"
typedef enum {
kStmtSelect,
kStmtDelete,
@ -17,9 +18,24 @@ typedef enum {
} StatementType;
const int64_t kNoLimit = -1;
const int64_t kNoOffset = -1;
typedef enum {
kOrderNone,
kOrderAsc,
kOrderDesc
} OrderType;
struct OrderDescription {
OrderType type;
Expr* expr;
};
struct Statement {
Statement(StatementType type) : type(type) {};
StatementType type;
};
@ -29,8 +45,14 @@ struct SelectStatement : Statement {
TableRef* from_table;
List<Expr*>* select_list;
List<Expr*>* group_by;
Expr* where_clause;
List<Expr*>* group_by;
Expr* having;
OrderDescription *order;
int64_t limit;
int64_t offset;
};