OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBETypes.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
20 #include "Shared/sqltypes.h"
21 
22 namespace EmbeddedDatabase {
23 
24 enum class ColumnType {
25  SMALLINT = 0,
26  INT = 1,
27  BIGINT = 2,
28  FLOAT = 3,
29  DECIMAL = 4,
30  DOUBLE = 5,
31  STR = 6,
32  TIME = 7,
33  TIMESTAMP = 8,
34  DATE = 9,
35  BOOL = 10,
36  INTERVAL_DAY_TIME = 11,
38  POINT = 13,
39  LINESTRING = 14,
40  POLYGON = 15,
41  MULTIPOLYGON = 16,
42  TINYINT = 17,
43  GEOMETRY = 18,
44  GEOGRAPHY = 19,
45  UNKNOWN = 20
46 };
47 
48 enum class ColumnEncoding {
49  NONE = 0,
50  FIXED = 1,
51  RL = 2,
52  DIFF = 3,
53  DICT = 4,
54  SPARSE = 5,
55  GEOINT = 6,
56  DATE_IN_DAYS = 7
57 };
58 
60  public:
61  std::string col_name;
64  bool nullable;
65  bool is_array;
66  int precision;
67  int scale;
69 
70  ColumnDetails();
71 
72  ColumnDetails(const std::string& col_name,
75  bool nullable,
76  bool is_array,
77  int precision,
78  int scale,
79  int comp_param);
80 };
81 
82 class Row {
83  public:
84  Row();
85  Row(std::vector<TargetValue>& row);
86  int64_t getInt(size_t col_num);
87  float getFloat(size_t col_num);
88  double getDouble(size_t col_num);
89  std::string getStr(size_t col_num);
90 
91  private:
92  std::vector<TargetValue> row_;
93 };
94 
97 } // namespace EmbeddedDatabase
std::string getStr(size_t col_num)
Definition: DBETypes.cpp:98
double getDouble(size_t col_num)
Definition: DBETypes.cpp:91
SQLTypes
Definition: sqltypes.h:65
High-level representation of SQL values.
Constants for Builtin SQL Types supported by HEAVY.AI.
float getFloat(size_t col_num)
Definition: DBETypes.cpp:84
int64_t getInt(size_t col_num)
Definition: DBETypes.cpp:77
ColumnType sqlToColumnType(const SQLTypes &type)
Definition: DBETypes.cpp:111
EncodingType
Definition: sqltypes.h:240
std::vector< TargetValue > row_
Definition: DBETypes.h:92
ColumnEncoding sqlToColumnEncoding(const EncodingType &type)
Definition: DBETypes.cpp:162