OmniSciDB  c07336695a
OmniSciData.java
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, 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 package com.omnisci.jdbc;
17 
18 import com.mapd.thrift.server.TColumn;
19 import com.mapd.thrift.server.TColumnData;
20 import com.mapd.thrift.server.TDatumType;
21 
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24 
29 class OmniSciData {
30  final static Logger logger = LoggerFactory.getLogger(OmniSciData.class);
32 
33  TColumn tcolumn;
34 
35  OmniSciData(TDatumType col_type) {
36  tcolumn = new TColumn();
37  colType = col_type;
38  tcolumn.data = new TColumnData();
39  }
40 
41  void add(String value) {
42  tcolumn.data.addToStr_col(value);
43  tcolumn.addToNulls(false);
44  }
45 
46  void add(int value) {
47  tcolumn.data.addToInt_col(value);
48  tcolumn.addToNulls(false);
49  }
50 
51  void setNull(boolean b) {
52  if (colType == TDatumType.STR)
53  tcolumn.data.addToStr_col(null);
54  else
55  tcolumn.data.addToInt_col(0);
56  tcolumn.addToNulls(b);
57  }
58 
59  TColumn getTColumn() {
60  return tcolumn;
61  }
62 }
void add(String value)
OmniSciData(TDatumType col_type)