YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/ptree/pt_insert_values_clause.h
Line
Count
Source (jump to first uncovered line)
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 INSERT INTO ... VALUES clause.
16
//--------------------------------------------------------------------------------------------------
17
18
#ifndef YB_YQL_CQL_QL_PTREE_PT_INSERT_VALUES_CLAUSE_H_
19
#define YB_YQL_CQL_QL_PTREE_PT_INSERT_VALUES_CLAUSE_H_
20
21
#include "yb/yql/cql/ql/ptree/list_node.h"
22
#include "yb/yql/cql/ql/ptree/pt_dml.h"
23
24
namespace yb {
25
namespace ql {
26
27
class PTInsertValuesClause : public PTCollection {
28
 public:
29
  //------------------------------------------------------------------------------------------------
30
  // Public types.
31
  typedef MCSharedPtr<PTInsertValuesClause> SharedPtr;
32
  typedef MCSharedPtr<const PTInsertValuesClause> SharedPtrConst;
33
34
  //------------------------------------------------------------------------------------------------
35
  // Constructor and destructor.
36
  PTInsertValuesClause(MemoryContext* memctx,
37
                       YBLocationPtr loc,
38
                       PTExprListNode::SharedPtr tuple);
39
  virtual ~PTInsertValuesClause();
40
41
  template<typename... TypeArgs>
42
  inline static PTInsertValuesClause::SharedPtr MakeShared(MemoryContext* memctx,
43
49.9k
                                                           TypeArgs&& ... args) {
44
49.9k
    return MCMakeShared<PTInsertValuesClause>(memctx, std::forward<TypeArgs>(args)...);
45
49.9k
  }
46
47
  // Node type.
48
3.94M
  TreeNodeOpcode opcode() const override {
49
3.94M
    return TreeNodeOpcode::kPTInsertValuesClause;
50
3.94M
  }
51
52
  // Add a tree node at the end.
53
  void Append(const PTExprListNode::SharedPtr& tnode);
54
  void Prepend(const PTExprListNode::SharedPtr& tnode);
55
56
  // Node semantics analysis.
57
  CHECKED_STATUS Analyze(SemContext* sem_context) override;
58
  void PrintSemanticAnalysisResult(SemContext* sem_context);
59
60
  // Access function for tuples_.
61
0
  const TreeListNode<PTExprListNode>& tuples() {
62
0
    return tuples_;
63
0
  }
64
65
  // Number of provided tuples.
66
49.7k
  size_t TupleCount() const {
67
49.7k
    return tuples_.size();
68
49.7k
  }
69
70
  PTExprListNode::SharedPtr Tuple(int index) const;
71
72
 private:
73
  TreeListNode<PTExprListNode> tuples_;
74
};
75
76
}  // namespace ql
77
}  // namespace yb
78
79
#endif // YB_YQL_CQL_QL_PTREE_PT_INSERT_VALUES_CLAUSE_H_