/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/ptree/pt_delete.h
Line | Count | Source |
1 | | //-------------------------------------------------------------------------------------------------- |
2 | | // Copyright (c) YugaByte, Inc. |
3 | | // |
4 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
5 | | // in compliance with the License. You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
10 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
11 | | // or implied. See the License for the specific language governing permissions and limitations |
12 | | // under the License. |
13 | | // |
14 | | // |
15 | | // Tree node definitions for DELETE statement. |
16 | | //-------------------------------------------------------------------------------------------------- |
17 | | |
18 | | #ifndef YB_YQL_CQL_QL_PTREE_PT_DELETE_H_ |
19 | | #define YB_YQL_CQL_QL_PTREE_PT_DELETE_H_ |
20 | | |
21 | | #include "yb/yql/cql/ql/ptree/list_node.h" |
22 | | #include "yb/yql/cql/ql/ptree/tree_node.h" |
23 | | #include "yb/yql/cql/ql/ptree/pt_dml.h" |
24 | | #include "yb/yql/cql/ql/ptree/pt_select.h" |
25 | | |
26 | | namespace yb { |
27 | | namespace ql { |
28 | | |
29 | | //-------------------------------------------------------------------------------------------------- |
30 | | |
31 | | class PTDeleteStmt : public PTDmlStmt { |
32 | | public: |
33 | | //------------------------------------------------------------------------------------------------ |
34 | | // Public types. |
35 | | typedef MCSharedPtr<PTDeleteStmt> SharedPtr; |
36 | | typedef MCSharedPtr<const PTDeleteStmt> SharedPtrConst; |
37 | | |
38 | | //------------------------------------------------------------------------------------------------ |
39 | | // Constructor and destructor. |
40 | | PTDeleteStmt(MemoryContext *memctx, |
41 | | YBLocationPtr loc, |
42 | | PTExprListNode::SharedPtr target, |
43 | | PTTableRef::SharedPtr relation, |
44 | | PTDmlUsingClausePtr using_clause = nullptr, |
45 | | PTExprPtr where_clause = nullptr, |
46 | | PTExprPtr if_clause = nullptr, |
47 | | bool else_error = false, |
48 | | bool returns_status = false); |
49 | | virtual ~PTDeleteStmt(); |
50 | | |
51 | | template<typename... TypeArgs> |
52 | | inline static PTDeleteStmt::SharedPtr MakeShared(MemoryContext *memctx, |
53 | 815 | TypeArgs&&... args) { |
54 | 815 | return MCMakeShared<PTDeleteStmt>(memctx, std::forward<TypeArgs>(args)...); |
55 | 815 | } std::__1::shared_ptr<yb::ql::PTDeleteStmt> yb::ql::PTDeleteStmt::MakeShared<std::__1::shared_ptr<yb::ql::Location>, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, std::__1::shared_ptr<yb::ql::PTTableRef>&, std::__1::shared_ptr<yb::ql::PTDmlUsingClause>&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::nullptr_t, bool, bool&>(yb::internal::ArenaBase<yb::internal::ArenaTraits>*, std::__1::shared_ptr<yb::ql::Location>&&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, std::__1::shared_ptr<yb::ql::PTTableRef>&, std::__1::shared_ptr<yb::ql::PTDmlUsingClause>&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::nullptr_t&&, bool&&, bool&) Line | Count | Source | 53 | 788 | TypeArgs&&... args) { | 54 | 788 | return MCMakeShared<PTDeleteStmt>(memctx, std::forward<TypeArgs>(args)...); | 55 | 788 | } |
std::__1::shared_ptr<yb::ql::PTDeleteStmt> yb::ql::PTDeleteStmt::MakeShared<std::__1::shared_ptr<yb::ql::Location>, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, std::__1::shared_ptr<yb::ql::PTTableRef>&, std::__1::shared_ptr<yb::ql::PTDmlUsingClause>&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::__1::shared_ptr<yb::ql::PTExpr>&, bool&, bool&>(yb::internal::ArenaBase<yb::internal::ArenaTraits>*, std::__1::shared_ptr<yb::ql::Location>&&, std::__1::shared_ptr<yb::ql::TreeListNode<yb::ql::PTExpr> >&, std::__1::shared_ptr<yb::ql::PTTableRef>&, std::__1::shared_ptr<yb::ql::PTDmlUsingClause>&, std::__1::shared_ptr<yb::ql::PTExpr>&, std::__1::shared_ptr<yb::ql::PTExpr>&, bool&, bool&) Line | Count | Source | 53 | 27 | TypeArgs&&... args) { | 54 | 27 | return MCMakeShared<PTDeleteStmt>(memctx, std::forward<TypeArgs>(args)...); | 55 | 27 | } |
|
56 | | |
57 | | // Node semantics analysis. |
58 | | virtual CHECKED_STATUS Analyze(SemContext *sem_context) override; |
59 | | void PrintSemanticAnalysisResult(SemContext *sem_context); |
60 | | ExplainPlanPB AnalysisResultToPB() override; |
61 | | |
62 | | // Table name. |
63 | 1.85k | client::YBTableName table_name() const override { |
64 | 1.85k | return relation_->table_name(); |
65 | 1.85k | } |
66 | | |
67 | | // Returns location of table name. |
68 | 1 | const YBLocation& table_loc() const override { |
69 | 1 | return relation_->loc(); |
70 | 1 | } |
71 | | |
72 | | // Node type. |
73 | 10.4k | virtual TreeNodeOpcode opcode() const override { |
74 | 10.4k | return TreeNodeOpcode::kPTDeleteStmt; |
75 | 10.4k | } |
76 | | |
77 | | CHECKED_STATUS AnalyzeTarget(TreeNode *target, SemContext *sem_context); |
78 | | |
79 | 2.71k | bool IsWriteOp() const override { |
80 | 2.71k | return true; |
81 | 2.71k | } |
82 | | |
83 | | private: |
84 | | // --- The parser will decorate this node with the following information -- |
85 | | |
86 | | PTExprListNode::SharedPtr target_; |
87 | | PTTableRef::SharedPtr relation_; |
88 | | }; |
89 | | |
90 | | } // namespace ql |
91 | | } // namespace yb |
92 | | |
93 | | #endif // YB_YQL_CQL_QL_PTREE_PT_DELETE_H_ |