-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathSelectStatement.h
More file actions
71 lines (58 loc) · 1.45 KB
/
SelectStatement.h
File metadata and controls
71 lines (58 loc) · 1.45 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
#ifndef __SELECT_STATEMENT_H__
#define __SELECT_STATEMENT_H__
#include "SQLStatement.h"
#include "Expr.h"
#include "Table.h"
namespace hsql {
enum OrderType {
kOrderAsc,
kOrderDesc
};
/**
* Description of the order by clause within a select statement
* TODO: hold multiple expressions to be sorted by
*/
struct OrderDescription {
OrderDescription(OrderType type, Expr* expr);
virtual ~OrderDescription();
OrderType type;
Expr* expr;
};
const int64_t kNoLimit = -1;
const int64_t kNoOffset = -1;
/**
* Description of the limit clause within a select statement
*/
struct LimitDescription {
LimitDescription(int64_t limit, int64_t offset);
int64_t limit;
int64_t offset;
};
/**
* Description of the group-by clause within a select statement
*/
struct GroupByDescription {
GroupByDescription();
// TODO: make virtual
~GroupByDescription();
std::vector<Expr*>* columns;
Expr* having;
};
/**
* Representation of a full SQL select statement.
* TODO: add union_order and union_limit
*/
struct SelectStatement : SQLStatement {
SelectStatement();
virtual ~SelectStatement();
TableRef* fromTable;
bool selectDistinct;
std::vector<Expr*>* selectList;
Expr* whereClause;
GroupByDescription* groupBy;
SelectStatement* unionSelect;
std::vector<OrderDescription*>* order;
LimitDescription* limit;
};
} // namespace hsql
#endif