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_dml_using_clause.h
Line
Count
Source
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
//
13
14
#ifndef YB_YQL_CQL_QL_PTREE_PT_DML_USING_CLAUSE_H
15
#define YB_YQL_CQL_QL_PTREE_PT_DML_USING_CLAUSE_H
16
17
#include "yb/yql/cql/ql/ptree/pt_dml_using_clause_element.h"
18
#include "yb/yql/cql/ql/ptree/list_node.h"
19
20
namespace yb {
21
namespace ql {
22
23
// USING clause for INSERT, UPDATE and DELETE statements.
24
class PTDmlUsingClause: public TreeListNode<PTDmlUsingClauseElement> {
25
 public:
26
  //------------------------------------------------------------------------------------------------
27
  // Public types.
28
  typedef MCSharedPtr<PTDmlUsingClause> SharedPtr;
29
  typedef MCSharedPtr<const PTDmlUsingClause> SharedPtrConst;
30
31
  explicit PTDmlUsingClause(MemoryContext *memory_context,
32
                            YBLocationPtr loc,
33
                            const MCSharedPtr<PTDmlUsingClauseElement>& tnode = nullptr)
34
      : TreeListNode<PTDmlUsingClauseElement>(memory_context, loc, tnode),
35
        ttl_seconds_(nullptr),
36
212
        user_timestamp_usec_(nullptr) {
37
212
  }
38
39
192
  virtual ~PTDmlUsingClause() {
40
192
  }
41
42
  template<typename... TypeArgs>
43
  inline static PTDmlUsingClause::SharedPtr MakeShared(MemoryContext *memctx,
44
212
                                                       TypeArgs&&...args) {
45
212
    return MCMakeShared<PTDmlUsingClause>(memctx, std::forward<TypeArgs>(args)...);
46
212
  }
47
48
  virtual CHECKED_STATUS Analyze(SemContext *sem_context) override;
49
50
  const PTExprPtr& ttl_seconds() const;
51
52
  const PTExprPtr& user_timestamp_usec() const;
53
54
34
  bool has_user_timestamp_usec() const {
55
34
    return user_timestamp_usec_ != nullptr;
56
34
  }
57
58
16
  bool has_ttl_seconds() const {
59
16
    return ttl_seconds_ != nullptr;
60
16
  }
61
62
 private:
63
  PTExprPtr ttl_seconds_;
64
  PTExprPtr user_timestamp_usec_;
65
};
66
67
} // namespace ql
68
} // namespace yb
69
70
#endif // YB_YQL_CQL_QL_PTREE_PT_DML_USING_CLAUSE_H