/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/ptree/pt_use_keyspace.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 USE KEYSPACE statement. |
16 | | //-------------------------------------------------------------------------------------------------- |
17 | | |
18 | | #ifndef YB_YQL_CQL_QL_PTREE_PT_USE_KEYSPACE_H_ |
19 | | #define YB_YQL_CQL_QL_PTREE_PT_USE_KEYSPACE_H_ |
20 | | |
21 | | #include "yb/yql/cql/ql/ptree/tree_node.h" |
22 | | |
23 | | namespace yb { |
24 | | namespace ql { |
25 | | |
26 | | //-------------------------------------------------------------------------------------------------- |
27 | | // USE KEYSPACE statement. |
28 | | |
29 | | class PTUseKeyspace : public TreeNode { |
30 | | public: |
31 | | //------------------------------------------------------------------------------------------------ |
32 | | // Public types. |
33 | | typedef MCSharedPtr<PTUseKeyspace> SharedPtr; |
34 | | typedef MCSharedPtr<const PTUseKeyspace> SharedPtrConst; |
35 | | |
36 | | //------------------------------------------------------------------------------------------------ |
37 | | // Constructor and destructor. |
38 | | PTUseKeyspace(MemoryContext *memctx, |
39 | | YBLocationPtr loc, |
40 | | const MCSharedPtr<MCString>& name); |
41 | | virtual ~PTUseKeyspace(); |
42 | | |
43 | | template<typename... TypeArgs> |
44 | 4.49k | inline static PTUseKeyspace::SharedPtr MakeShared(MemoryContext *memctx, TypeArgs&&... args) { |
45 | 4.49k | return MCMakeShared<PTUseKeyspace>(memctx, std::forward<TypeArgs>(args)...); |
46 | 4.49k | } |
47 | | |
48 | | // Node type. |
49 | 20.1k | virtual TreeNodeOpcode opcode() const override { |
50 | 20.1k | return TreeNodeOpcode::kPTUseKeyspace; |
51 | 20.1k | } |
52 | | |
53 | | // Node semantics analysis. |
54 | | virtual CHECKED_STATUS Analyze(SemContext *sem_context) override; |
55 | | void PrintSemanticAnalysisResult(SemContext *sem_context); |
56 | | |
57 | | const char* name() const; |
58 | | |
59 | | private: |
60 | | MCSharedPtr<MCString> name_; |
61 | | }; |
62 | | |
63 | | } // namespace ql |
64 | | } // namespace yb |
65 | | |
66 | | #endif // YB_YQL_CQL_QL_PTREE_PT_USE_KEYSPACE_H_ |