CUBRID Engine  latest
parse_type.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * parse_type.hpp
21  */
22 
23 #ifndef _PARSE_TYPE_HPP_
24 #define _PARSE_TYPE_HPP_
25 
26 #include "parse_tree.h"
27 #include <string>
28 class string_buffer;
29 
30 /* generic types */
32 {
34  PT_GENERIC_TYPE_STRING, // any type of string
35  PT_GENERIC_TYPE_STRING_VARYING, // VARCHAR or VARNCHAR
36  PT_GENERIC_TYPE_CHAR, // VARCHAR or CHAR
37  PT_GENERIC_TYPE_NCHAR, // VARNCHAR or NCHAR
38  PT_GENERIC_TYPE_BIT, // BIT OR VARBIT
39  PT_GENERIC_TYPE_DISCRETE_NUMBER, // SMALLINT, INTEGER, BIGINTEGER
40  PT_GENERIC_TYPE_NUMBER, // any number type
41  PT_GENERIC_TYPE_DATE, // date, datetime or timestamp
42  PT_GENERIC_TYPE_DATETIME, // any date or time type
43  PT_GENERIC_TYPE_SEQUENCE, // any type of sequence
44  PT_GENERIC_TYPE_LOB, // BLOB or CLOB
45  PT_GENERIC_TYPE_QUERY, // Sub query (for range operators)
46  PT_GENERIC_TYPE_PRIMITIVE, // primitive types
47  PT_GENERIC_TYPE_ANY, // any type
48  PT_GENERIC_TYPE_JSON_VAL, // PT_TYPE_VARCHAR, PT_TYPE_VARCHAR, PT_TYPE_CHAR, PT_TYPE_NCHAR,
49  // PT_TYPE_NUMERIC, DB_TYPE_SHORT, PT_TYPE_INTEGER, PT_TYPE_LOGICAL, PT_TYPE_DOUBLE,
50  // PT_TYPE_BIGINT, PT_TYPE_JSON, PT_TYPE_MAYBE, PT_TYPE_NULL
51  PT_GENERIC_TYPE_JSON_DOC, // PT_TYPE_VARCHAR, PT_TYPE_VARNCHAR, PT_TYPE_CHAR, PT_TYPE_NCHAR,
52  // PT_TYPE_JSON, PT_TYPE_MAYBE, PT_TYPE_NULL
53  PT_GENERIC_TYPE_SCALAR, // any type but set
54 };
55 
57 
58 /* expression argument type */
60 {
61  enum
62  {
66  } type;
67 
69  {
72  size_t index; //index type
73 
75  : type (type)
76  {
77  }
78 
80  : generic_type (enum_val)
81  {
82  }
83 
84  pt_arg_type_val (size_t index)
85  : index (index)
86  {
87  }
88  } val;
89 
91  : type (NORMAL)
92  , val (type)
93  {
94  }
95 
97  : type (GENERIC)
98  , val (generic_type)
99  {
100  }
101 
103  : type (INDEX)
104  , val (index)
105  {
106  }
107 
108  void operator() (pt_type_enum normal_type)
109  {
110  type = NORMAL;
111  val.type = normal_type;
112  }
113 
115  {
116  type = GENERIC;
118  }
119 
120  void operator() (size_t index)
121  {
122  type = INDEX;
123  val.index = index;
124  }
125 };
127 
130 
131 #endif // _PARSE_TYPE_HPP_
pt_generic_type_enum generic_type
Definition: parse_type.hpp:71
pt_arg_type_val(pt_type_enum type)
Definition: parse_type.hpp:74
void operator()(pt_type_enum normal_type)
Definition: parse_type.hpp:108
enum pt_type_enum PT_TYPE_ENUM
Definition: parse_tree.h:962
pt_arg_type(pt_generic_type_enum generic_type)
Definition: parse_type.hpp:96
pt_arg_type(pt_type_enum type=PT_TYPE_NONE)
Definition: parse_type.hpp:90
enum pt_arg_type::@135 type
pt_arg_type(size_t index)
Definition: parse_type.hpp:102
const char * pt_generic_type_to_string(pt_generic_type_enum type)
Definition: parse_type.cpp:27
pt_arg_type PT_ARG_TYPE
Definition: parse_type.hpp:126
pt_generic_type_enum
Definition: parse_type.hpp:31
union pt_arg_type::pt_arg_type_val val
pt_type_enum
Definition: parse_tree.h:907
const char * pt_arg_type_to_string_buffer(const pt_arg_type &type, string_buffer &sb)
Definition: parse_type.cpp:56
PT_TYPE_ENUM pt_to_variable_size_type(PT_TYPE_ENUM type_enum)
pt_arg_type_val(pt_generic_type_enum enum_val)
Definition: parse_type.hpp:79