minor changes
This commit is contained in:
parent
6d9a7b661c
commit
48dbab8258
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
CC = g++
|
CC = g++
|
||||||
CFLAGS = -O3 -Ilib/ -I./ -Iparser/ -std=c++11 -pthread
|
CFLAGS = -O3 -Ilib/ -I./ -Iparser/ -std=c++11 -pthread -Wall -g
|
||||||
SOURCES = $(shell find lib/ -name '*.cpp') parser/bison_parser.cpp parser/flex_lexer.cpp parser/SQLParser.cpp
|
SOURCES = $(shell find lib/ -name '*.cpp') parser/bison_parser.cpp parser/flex_lexer.cpp parser/SQLParser.cpp
|
||||||
BUILD_DIR = ../build/
|
BUILD_DIR = ../build/
|
||||||
BIN_DIR = ../bin
|
BIN_DIR = ../bin
|
||||||
|
|
|
@ -17,7 +17,7 @@ char* substr(const char* source, int from, int to) {
|
||||||
|
|
||||||
|
|
||||||
Expr* Expr::makeOpUnary(OperatorType op, Expr* expr) {
|
Expr* Expr::makeOpUnary(OperatorType op, Expr* expr) {
|
||||||
ALLOC_EXPR(e, kExprOperator);
|
Expr* e = new Expr(kExprOperator);
|
||||||
e->op_type = op;
|
e->op_type = op;
|
||||||
e->expr = expr;
|
e->expr = expr;
|
||||||
e->expr2 = NULL;
|
e->expr2 = NULL;
|
||||||
|
@ -27,7 +27,7 @@ Expr* Expr::makeOpUnary(OperatorType op, Expr* expr) {
|
||||||
|
|
||||||
|
|
||||||
Expr* Expr::makeOpBinary(Expr* expr1, OperatorType op, Expr* expr2) {
|
Expr* Expr::makeOpBinary(Expr* expr1, OperatorType op, Expr* expr2) {
|
||||||
ALLOC_EXPR(e, kExprOperator);
|
Expr* e = new Expr(kExprOperator);
|
||||||
e->op_type = op;
|
e->op_type = op;
|
||||||
e->op_char = 0;
|
e->op_char = 0;
|
||||||
e->expr = expr1;
|
e->expr = expr1;
|
||||||
|
@ -36,7 +36,7 @@ Expr* Expr::makeOpBinary(Expr* expr1, OperatorType op, Expr* expr2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr* Expr::makeOpBinary(Expr* expr1, char op, Expr* expr2) {
|
Expr* Expr::makeOpBinary(Expr* expr1, char op, Expr* expr2) {
|
||||||
ALLOC_EXPR(e, kExprOperator);
|
Expr* e = new Expr(kExprOperator);
|
||||||
e->op_type = SIMPLE_OP;
|
e->op_type = SIMPLE_OP;
|
||||||
e->op_char = op;
|
e->op_char = op;
|
||||||
e->expr = expr1;
|
e->expr = expr1;
|
||||||
|
@ -47,39 +47,39 @@ Expr* Expr::makeOpBinary(Expr* expr1, char op, Expr* expr2) {
|
||||||
|
|
||||||
|
|
||||||
Expr* Expr::makeLiteral(int64_t val) {
|
Expr* Expr::makeLiteral(int64_t val) {
|
||||||
ALLOC_EXPR(e, kExprLiteralInt);
|
Expr* e = new Expr(kExprLiteralInt);
|
||||||
e->ival = val;
|
e->ival = val;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr* Expr::makeLiteral(double value) {
|
Expr* Expr::makeLiteral(double value) {
|
||||||
ALLOC_EXPR(e, kExprLiteralFloat);
|
Expr* e = new Expr(kExprLiteralFloat);
|
||||||
e->fval = value;
|
e->fval = value;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr* Expr::makeLiteral(char* string) {
|
Expr* Expr::makeLiteral(char* string) {
|
||||||
ALLOC_EXPR(e, kExprLiteralString);
|
Expr* e = new Expr(kExprLiteralString);
|
||||||
e->name = string;
|
e->name = string;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Expr* Expr::makeColumnRef(char* name) {
|
Expr* Expr::makeColumnRef(char* name) {
|
||||||
ALLOC_EXPR(e, kExprColumnRef);
|
Expr* e = new Expr(kExprColumnRef);
|
||||||
e->name = name;
|
e->name = name;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr* Expr::makeColumnRef(char* table, char* name) {
|
Expr* Expr::makeColumnRef(char* table, char* name) {
|
||||||
ALLOC_EXPR(e, kExprTableColumnRef);
|
Expr* e = new Expr(kExprTableColumnRef);
|
||||||
e->name = name;
|
e->name = name;
|
||||||
e->table = table;
|
e->table = table;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr* Expr::makeFunctionRef(char* func_name, Expr* expr) {
|
Expr* Expr::makeFunctionRef(char* func_name, Expr* expr) {
|
||||||
ALLOC_EXPR(e, kExprFunctionRef);
|
Expr* e = new Expr(kExprFunctionRef);
|
||||||
e->name = func_name;
|
e->name = func_name;
|
||||||
e->expr = expr;
|
e->expr = expr;
|
||||||
return e;
|
return e;
|
||||||
|
|
|
@ -91,6 +91,7 @@ struct Expr {
|
||||||
// Zero initializes an Expr object and assigns it to a space in the heap
|
// Zero initializes an Expr object and assigns it to a space in the heap
|
||||||
// For Hyrise we still had to put in the explicit NULL constructor
|
// For Hyrise we still had to put in the explicit NULL constructor
|
||||||
// http://www.ex-parrot.com/~chris/random/initialise.html
|
// http://www.ex-parrot.com/~chris/random/initialise.html
|
||||||
|
// Unused
|
||||||
#define ALLOC_EXPR(var, type) \
|
#define ALLOC_EXPR(var, type) \
|
||||||
Expr* var; \
|
Expr* var; \
|
||||||
do { \
|
do { \
|
||||||
|
@ -98,6 +99,7 @@ struct Expr {
|
||||||
var = (Expr*)malloc(sizeof *var); \
|
var = (Expr*)malloc(sizeof *var); \
|
||||||
*var = zero; \
|
*var = zero; \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
#undef ALLOC_EXPR
|
||||||
|
|
||||||
|
|
||||||
} // namespace hsql
|
} // namespace hsql
|
||||||
|
|
|
@ -48,6 +48,7 @@ struct LimitDescription {
|
||||||
/**
|
/**
|
||||||
* @struct SelectStatement
|
* @struct SelectStatement
|
||||||
* Representation of a full select statement.
|
* Representation of a full select statement.
|
||||||
|
* TODO: add union_order and union_limit
|
||||||
*/
|
*/
|
||||||
struct SelectStatement : Statement {
|
struct SelectStatement : Statement {
|
||||||
SelectStatement() :
|
SelectStatement() :
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
/* other flags */
|
/* other flags */
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
|
%option nounput
|
||||||
%option warn
|
%option warn
|
||||||
%option case-insensitive
|
%option case-insensitive
|
||||||
%option prefix="hsql_"
|
%option prefix="hsql_"
|
||||||
|
|
|
@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
bool expect_false = false;
|
bool expect_false = false;
|
||||||
bool use_file = false;
|
bool use_file = false;
|
||||||
char* file_path;
|
std::string file_path = "";
|
||||||
|
|
||||||
// Parse command line arguments
|
// Parse command line arguments
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
Loading…
Reference in New Issue