Repository navigation
Expand file tree
/
Copy pathTable.h
More file actions
80 lines (62 loc) · 1.51 KB
/
Copy pathTable.h
File metadata and controls
80 lines (62 loc) · 1.51 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
#pragma once
#include "Expr.h"
#include <stdio.h>
#include <vector>
namespace hsql {
struct SelectStatement;
struct JoinDefinition;
struct TableRef;
// Possible table reference types.
enum TableRefType {
kTableName,
kTableSelect,
kTableJoin,
kTableCrossProduct
};
struct TableName {
char* schema;
char* name;
};
struct Alias {
Alias(char* name, std::vector<char*>* columns = nullptr);
~Alias();
char* name;
std::vector<char*>* columns;
};
// Holds reference to tables. Can be either table names or a select statement.
struct TableRef {
TableRef(TableRefType type);
virtual ~TableRef();
void tablesAccessed(TableAccessMap& accessMap, const std::string& op) const;
TableRefType type;
char* schema;
char* name;
Alias* alias;
SelectStatement* select;
std::vector<TableRef*>* list;
JoinDefinition* join;
// Returns true if a schema is set.
bool hasSchema() const;
// Returns the alias, if it is set. Otherwise the name.
const char* getName() const;
};
// Possible types of joins.
enum JoinType {
kJoinInner,
kJoinFull,
kJoinLeft,
kJoinRight,
kJoinCross,
kJoinNatural
};
// Definition of a join construct.
struct JoinDefinition {
JoinDefinition();
virtual ~JoinDefinition();
void tablesAccessed(TableAccessMap& accessMap, const std::string& op) const;
TableRef* left;
TableRef* right;
Expr* condition;
JoinType type;
};
} // namespace hsql