added some convenience methods
This commit is contained in:
parent
48dbab8258
commit
1c1902538e
|
@ -75,6 +75,22 @@ struct Expr {
|
|||
OperatorType op_type;
|
||||
char op_char;
|
||||
|
||||
|
||||
/**
|
||||
* Convenience accessor methods
|
||||
*/
|
||||
inline bool hasAlias() { return alias != NULL; }
|
||||
inline char* getName() {
|
||||
if (alias != NULL) return alias;
|
||||
else return name;
|
||||
}
|
||||
inline bool isSimpleOp() { return op_type == SIMPLE_OP; }
|
||||
inline bool isSimpleOp(char op) { return isSimpleOp() && op_char == op; }
|
||||
|
||||
|
||||
/**
|
||||
* Static expression constructors
|
||||
*/
|
||||
static Expr* makeOpUnary(OperatorType op, Expr* expr);
|
||||
static Expr* makeOpBinary(Expr* expr1, char op, Expr* expr2);
|
||||
static Expr* makeOpBinary(Expr* expr1, OperatorType op, Expr* expr2);
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct TableRef TableRef;
|
|||
struct TableRef {
|
||||
TableRef(TableRefType type) :
|
||||
type(type),
|
||||
schema(NULL),
|
||||
name(NULL),
|
||||
alias(NULL),
|
||||
select(NULL),
|
||||
|
@ -43,17 +44,29 @@ struct TableRef {
|
|||
|
||||
TableRefType type;
|
||||
|
||||
char* schema;
|
||||
char* name;
|
||||
char* alias;
|
||||
|
||||
SelectStatement* select;
|
||||
List<TableRef*>* list;
|
||||
|
||||
// Join memberbs
|
||||
// Join members
|
||||
TableRef* left;
|
||||
TableRef* right;
|
||||
JoinType join_type;
|
||||
Expr* join_condition;
|
||||
|
||||
|
||||
/**
|
||||
* Convenience accessor methods
|
||||
*/
|
||||
inline bool hasSchema() { return schema != NULL; }
|
||||
|
||||
inline char* getName() {
|
||||
if (alias != NULL) return alias;
|
||||
else return name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue