6
6
//
7
7
// Identification: src/include/common/statement.h
8
8
//
9
- // Copyright (c) 2015-16 , Carnegie Mellon University Database Group
9
+ // Copyright (c) 2015-2018 , Carnegie Mellon University Database Group
10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
12
22
22
#include " parser/sql_statement.h"
23
23
24
24
namespace peloton {
25
+
25
26
namespace planner {
26
27
class AbstractPlan ;
27
- }
28
+ } // namespace planner
28
29
29
30
// Contains the value of a column in a tuple of the result set.
30
31
// std::string since the result is sent to the client over the network.
@@ -38,55 +39,60 @@ typedef std::tuple<std::string, oid_t, size_t> FieldInfo;
38
39
class Statement : public Printable {
39
40
public:
40
41
Statement () = delete ;
41
- Statement (const Statement&) = delete ;
42
- Statement& operator =(const Statement&) = delete ;
43
- Statement (Statement&&) = delete ;
44
- Statement& operator =(Statement&&) = delete ;
42
+ Statement (const Statement &) = delete ;
43
+ Statement & operator =(const Statement &) = delete ;
44
+ Statement (Statement &&) = delete ;
45
+ Statement & operator =(Statement &&) = delete ;
45
46
46
- Statement (const std::string& statement_name, const std::string& query_string);
47
- Statement (const std::string& statement_name, QueryType query_type,
48
- std::string query_string, std::unique_ptr<parser::SQLStatementList> sql_stmt_list);
47
+ Statement (const std::string &statement_name, const std::string &query_string);
48
+ Statement (const std::string &statement_name, QueryType query_type,
49
+ std::string query_string,
50
+ std::unique_ptr<parser::SQLStatementList> sql_stmt_list);
49
51
50
52
~Statement ();
51
53
52
54
std::vector<FieldInfo> GetTupleDescriptor () const ;
53
55
54
- void SetStatementName (const std::string& statement_name);
56
+ void SetStatementName (const std::string & statement_name);
55
57
56
58
std::string GetStatementName () const ;
57
59
58
- void SetQueryString (const std::string& query_string);
60
+ void SetQueryString (const std::string & query_string);
59
61
60
62
std::string GetQueryString () const ;
61
63
62
64
std::string GetQueryTypeString () const ;
63
65
64
66
QueryType GetQueryType () const ;
65
67
66
- void SetParamTypes (const std::vector<int32_t >& param_types);
68
+ void SetParamTypes (const std::vector<int32_t > & param_types);
67
69
68
70
std::vector<int32_t > GetParamTypes () const ;
69
71
70
- void SetTupleDescriptor (const std::vector<FieldInfo>& tuple_descriptor);
72
+ void SetTupleDescriptor (const std::vector<FieldInfo> & tuple_descriptor);
71
73
72
74
void SetReferencedTables (const std::set<oid_t > table_ids);
73
75
74
76
const std::set<oid_t > GetReferencedTables () const ;
75
77
76
78
void SetPlanTree (std::shared_ptr<planner::AbstractPlan> plan_tree);
77
79
78
- const std::shared_ptr<planner::AbstractPlan>& GetPlanTree () const ;
80
+ const std::shared_ptr<planner::AbstractPlan> & GetPlanTree () const ;
79
81
80
- std::unique_ptr<parser::SQLStatementList>const & GetStmtParseTreeList () {return sql_stmt_list_;}
82
+ std::unique_ptr<parser::SQLStatementList> const &GetStmtParseTreeList () {
83
+ return sql_stmt_list_;
84
+ }
81
85
82
- std::unique_ptr<parser::SQLStatementList> PassStmtParseTreeList () {return std::move (sql_stmt_list_);}
86
+ std::unique_ptr<parser::SQLStatementList> PassStmtParseTreeList () {
87
+ return std::move (sql_stmt_list_);
88
+ }
83
89
84
90
inline bool GetNeedsReplan () const { return (needs_replan_); }
85
91
86
92
inline void SetNeedsReplan (bool replan) { needs_replan_ = replan; }
87
93
88
94
// Get a string representation for debugging
89
- const std::string GetInfo () const ;
95
+ const std::string GetInfo () const override ;
90
96
91
97
private:
92
98
// logical name of statement
@@ -102,8 +108,8 @@ class Statement : public Printable {
102
108
std::unique_ptr<parser::SQLStatementList> sql_stmt_list_;
103
109
104
110
// first token in query
105
- // Keep the string token of the query_type because it is returned
106
- // as responses after executing commands.
111
+ // Keep the string token of the query_type because it is returned as responses
112
+ // after executing commands.
107
113
std::string query_type_string_;
108
114
109
115
// format codes of the parameters
@@ -122,4 +128,5 @@ class Statement : public Printable {
122
128
// If this flag is true, then somebody wants us to replan this query
123
129
bool needs_replan_ = false ;
124
130
};
131
+
125
132
} // namespace peloton
0 commit comments