OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DatumFetchers.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 
19 #include "sqltypes.h"
20 
21 namespace DatumFetcher {
22 
23 template <typename T>
24 inline T getDatumVal(const Datum& d);
25 
26 template <>
27 inline int8_t getDatumVal(const Datum& d) {
28  return d.tinyintval;
29 }
30 
31 template <>
32 inline int16_t getDatumVal(const Datum& d) {
33  return d.smallintval;
34 }
35 
36 template <>
37 inline int32_t getDatumVal(const Datum& d) {
38  return d.intval;
39 }
40 
41 template <>
42 inline int64_t getDatumVal(const Datum& d) {
43  return d.bigintval;
44 }
45 
46 template <>
47 inline uint8_t getDatumVal(const Datum& d) {
48  return d.tinyintval;
49 }
50 
51 template <>
52 inline uint16_t getDatumVal(const Datum& d) {
53  return d.smallintval;
54 }
55 
56 template <>
57 inline float getDatumVal(const Datum& d) {
58  return d.floatval;
59 }
60 
61 template <>
62 inline double getDatumVal(const Datum& d) {
63  return d.doubleval;
64 }
65 
66 } // namespace DatumFetcher
int8_t tinyintval
Definition: Datum.h:73
Constants for Builtin SQL Types supported by HEAVY.AI.
int32_t intval
Definition: Datum.h:75
T getDatumVal(const Datum &d)
Definition: DatumFetchers.h:27
float floatval
Definition: Datum.h:77
int64_t bigintval
Definition: Datum.h:76
int16_t smallintval
Definition: Datum.h:74
Definition: Datum.h:71
double doubleval
Definition: Datum.h:78