added special expression type for star selector

This commit is contained in:
Pedro 2014-10-22 17:46:52 +02:00
parent 8e968ffb41
commit e886ae1644
3 changed files with 5 additions and 2 deletions

View File

@ -138,7 +138,7 @@ select_statement:
select_list: select_list:
'*' { $$ = new List<Expr*>(makeColumnRef("*")); } '*' { $$ = new List<Expr*>(new Expr(eExprStar)); }
| expr_list; | expr_list;

View File

@ -7,6 +7,7 @@
typedef enum { typedef enum {
eExprLiteralFloat, eExprLiteralFloat,
eExprLiteralString, eExprLiteralString,
eExprStar,
eExprColumnRef, eExprColumnRef,
eExprFunctionRef, eExprFunctionRef,
eExprPredicate eExprPredicate
@ -15,6 +16,8 @@ typedef enum {
typedef struct Expr Expr; typedef struct Expr Expr;
struct Expr { struct Expr {
Expr(EExprType type) : type(type) {};
EExprType type; EExprType type;
Expr* expr; Expr* expr;

View File

@ -56,7 +56,7 @@ void SelectTest2() {
SelectStatement* select = (SelectStatement*) stmt; SelectStatement* select = (SelectStatement*) stmt;
ASSERT(select->select_list->size() == 1); ASSERT(select->select_list->size() == 1);
ASSERT_STR(select->select_list->at(0)->name, "*"); ASSERT(select->select_list->at(0)->type == eExprStar);
ASSERT(select->from_table != NULL); ASSERT(select->from_table != NULL);
ASSERT(select->from_table->type == eTableSelect); ASSERT(select->from_table->type == eTableSelect);