Repository navigation
Expand file tree
/
Copy pathTable.h
More file actions
107 lines (83 loc) · 1.91 KB
/
Copy pathTable.h
File metadata and controls
107 lines (83 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef __TABLEREF_H__
#define __TABLEREF_H__
#include "Expr.h"
#include <stdio.h>
#include <vector>
namespace hsql {
struct SelectStatement;
struct JoinDefinition;
struct TableRef;
/**
* @enum TableRefType
* Types table references
*/
typedef enum {
kTableName,
kTableSelect,
kTableJoin,
kTableCrossProduct
} TableRefType;
/**
* @struct TableRef
* @brief Holds reference to tables. Can be either table names or a select statement.
*/
struct TableRef {
TableRef(TableRefType type) :
type(type),
schema(NULL),
name(NULL),
alias(NULL),
select(NULL),
list(NULL),
join(NULL) {}
virtual ~TableRef();
TableRefType type;
char* schema;
char* name;
char* alias;
SelectStatement* select;
std::vector<TableRef*>* list;
JoinDefinition* join;
/**
* Convenience accessor methods
*/
inline bool hasSchema() {
return schema != NULL;
}
inline char* getName() {
if (alias != NULL) return alias;
else return name;
}
};
/**
* @enum JoinType
* Types of joins
*/
typedef enum {
kJoinInner,
kJoinOuter,
kJoinLeft,
kJoinRight,
} JoinType;
/**
* @struct JoinDefinition
* @brief Definition of a join table
*/
struct JoinDefinition {
JoinDefinition() :
left(NULL),
right(NULL),
condition(NULL),
type(kJoinInner) {}
virtual ~JoinDefinition() {
delete left;
delete right;
delete condition;
}
TableRef* left;
TableRef* right;
Expr* condition;
JoinType type;
};
} // namespace hsql
#endif