OmniSciDB  2e3a973ef4
EmbeddedDatabase::Row Class Reference

#include <DBEngine.h>

Public Member Functions

 Row ()
 
 Row (std::vector< TargetValue > &row)
 
int64_t getInt (size_t col_num)
 
double getDouble (size_t col_num)
 
std::string getStr (size_t col_num)
 

Private Attributes

std::vector< TargetValuerow_
 

Detailed Description

Definition at line 28 of file DBEngine.h.

Constructor & Destructor Documentation

◆ Row() [1/2]

EmbeddedDatabase::Row::Row ( )

Definition at line 198 of file DBEngine.cpp.

198 {}

◆ Row() [2/2]

EmbeddedDatabase::Row::Row ( std::vector< TargetValue > &  row)

Definition at line 200 of file DBEngine.cpp.

200 : row_(std::move(row)) {}
std::vector< TargetValue > row_
Definition: DBEngine.h:37

Member Function Documentation

◆ getDouble()

double EmbeddedDatabase::Row::getDouble ( size_t  col_num)

Definition at line 211 of file DBEngine.cpp.

References row_.

211  {
212  if (col_num < row_.size()) {
213  const auto scalar_value = boost::get<ScalarTargetValue>(&row_[col_num]);
214  const auto value = boost::get<double>(scalar_value);
215  return *value;
216  }
217  return 0.;
218 }
std::vector< TargetValue > row_
Definition: DBEngine.h:37

◆ getInt()

int64_t EmbeddedDatabase::Row::getInt ( size_t  col_num)

Definition at line 202 of file DBEngine.cpp.

References row_.

202  {
203  if (col_num < row_.size()) {
204  const auto scalar_value = boost::get<ScalarTargetValue>(&row_[col_num]);
205  const auto value = boost::get<int64_t>(scalar_value);
206  return *value;
207  }
208  return 0;
209 }
std::vector< TargetValue > row_
Definition: DBEngine.h:37

◆ getStr()

std::string EmbeddedDatabase::Row::getStr ( size_t  col_num)

Definition at line 220 of file DBEngine.cpp.

References anonymous_namespace{TypedDataAccessors.h}::is_null(), and row_.

220  {
221  if (col_num < row_.size()) {
222  const auto scalar_value = boost::get<ScalarTargetValue>(&row_[col_num]);
223  auto value = boost::get<NullableString>(scalar_value);
224  bool is_null = !value || boost::get<void*>(value);
225  if (is_null) {
226  return "Empty";
227  } else {
228  auto value_notnull = boost::get<std::string>(value);
229  return *value_notnull;
230  }
231  }
232  return "Out of range";
233 }
bool is_null(const T &v, const SQLTypeInfo &t)
std::vector< TargetValue > row_
Definition: DBEngine.h:37
+ Here is the call graph for this function:

Member Data Documentation

◆ row_

std::vector<TargetValue> EmbeddedDatabase::Row::row_
private

Definition at line 37 of file DBEngine.h.

Referenced by getDouble(), getInt(), and getStr().


The documentation for this class was generated from the following files: