YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/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
752
                                                   TypeArgs&&... args) {
54
752
    return MCMakeShared<PTDeleteStmt>(memctx, std::forward<TypeArgs>(args)...);
55
752
  }
_ZN2yb2ql12PTDeleteStmt10MakeSharedIJNSt3__110shared_ptrINS0_8LocationEEERNS4_INS0_12TreeListNodeINS0_6PTExprEEEEERNS4_INS0_10PTTableRefEEERNS4_INS0_16PTDmlUsingClauseEEERNS4_IS8_EEDnbRbEEENS4_IS1_EEPNS_8internal9ArenaBaseINSM_11ArenaTraitsEEEDpOT_
Line
Count
Source
53
725
                                                   TypeArgs&&... args) {
54
725
    return MCMakeShared<PTDeleteStmt>(memctx, std::forward<TypeArgs>(args)...);
55
725
  }
_ZN2yb2ql12PTDeleteStmt10MakeSharedIJNSt3__110shared_ptrINS0_8LocationEEERNS4_INS0_12TreeListNodeINS0_6PTExprEEEEERNS4_INS0_10PTTableRefEEERNS4_INS0_16PTDmlUsingClauseEEERNS4_IS8_EESJ_RbSK_EEENS4_IS1_EEPNS_8internal9ArenaBaseINSM_11ArenaTraitsEEEDpOT_
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.72k
  client::YBTableName table_name() const override {
64
1.72k
    return relation_->table_name();
65
1.72k
  }
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
9.84k
  virtual TreeNodeOpcode opcode() const override {
74
9.84k
    return TreeNodeOpcode::kPTDeleteStmt;
75
9.84k
  }
76
77
  CHECKED_STATUS AnalyzeTarget(TreeNode *target, SemContext *sem_context);
78
79
2.52k
  bool IsWriteOp() const override {
80
2.52k
    return true;
81
2.52k
  }
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_