OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EmbeddedDatabase::CursorImpl Class Reference
+ Inheritance diagram for EmbeddedDatabase::CursorImpl:
+ Collaboration diagram for EmbeddedDatabase::CursorImpl:

Public Member Functions

 CursorImpl (std::shared_ptr< ResultSet > result_set, std::vector< std::string > col_names)
 
 ~CursorImpl ()
 
size_t getColCount ()
 
size_t getRowCount ()
 
Row getNextRow ()
 
ColumnType getColType (uint32_t col_num)
 
std::shared_ptr
< arrow::RecordBatch > 
getArrowRecordBatch ()
 
- Public Member Functions inherited from EmbeddedDatabase::Cursor
virtual ~Cursor ()
 
size_t getColCount ()
 
size_t getRowCount ()
 
Row getNextRow ()
 
ColumnType getColType (uint32_t col_num)
 
std::shared_ptr
< arrow::RecordBatch > 
getArrowRecordBatch ()
 

Private Attributes

std::shared_ptr< ResultSetresult_set_
 
std::vector< std::string > col_names_
 
std::shared_ptr
< arrow::RecordBatch > 
record_batch_
 

Additional Inherited Members

- Protected Member Functions inherited from EmbeddedDatabase::Cursor
 Cursor ()
 
 Cursor (const Cursor &)=delete
 
Cursoroperator= (const Cursor &)=delete
 

Detailed Description

Cursor internal implementation

Definition at line 41 of file DBEngine.cpp.

Constructor & Destructor Documentation

EmbeddedDatabase::CursorImpl::CursorImpl ( std::shared_ptr< ResultSet result_set,
std::vector< std::string >  col_names 
)
inline

Definition at line 43 of file DBEngine.cpp.

44  : result_set_(result_set), col_names_(col_names) {}
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90
std::vector< std::string > col_names_
Definition: DBEngine.cpp:91
EmbeddedDatabase::CursorImpl::~CursorImpl ( )
inline

Definition at line 46 of file DBEngine.cpp.

References col_names_, record_batch_, and result_set_.

46  {
47  col_names_.clear();
48  record_batch_.reset();
49  result_set_.reset();
50  }
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90
std::shared_ptr< arrow::RecordBatch > record_batch_
Definition: DBEngine.cpp:92
std::vector< std::string > col_names_
Definition: DBEngine.cpp:91

Member Function Documentation

std::shared_ptr<arrow::RecordBatch> EmbeddedDatabase::CursorImpl::getArrowRecordBatch ( )
inline

Definition at line 72 of file DBEngine.cpp.

References col_names_, getColCount(), getRowCount(), record_batch_, and result_set_.

Referenced by EmbeddedDatabase::Cursor::getArrowRecordBatch().

72  {
73  if (record_batch_) {
74  return record_batch_;
75  }
76  auto col_count = getColCount();
77  if (col_count > 0) {
78  auto row_count = getRowCount();
79  if (row_count > 0) {
80  auto converter =
81  std::make_unique<ArrowResultSetConverter>(result_set_, col_names_, -1);
82  record_batch_ = converter->convertToArrow();
83  return record_batch_;
84  }
85  }
86  return nullptr;
87  }
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90
std::shared_ptr< arrow::RecordBatch > record_batch_
Definition: DBEngine.cpp:92
std::vector< std::string > col_names_
Definition: DBEngine.cpp:91

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t EmbeddedDatabase::CursorImpl::getColCount ( )
inline

Definition at line 52 of file DBEngine.cpp.

References result_set_.

Referenced by getArrowRecordBatch(), EmbeddedDatabase::Cursor::getColCount(), and getColType().

52 { return result_set_ ? result_set_->colCount() : 0; }
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90

+ Here is the caller graph for this function:

ColumnType EmbeddedDatabase::CursorImpl::getColType ( uint32_t  col_num)
inline

Definition at line 64 of file DBEngine.cpp.

References SQLTypeInfo::get_type(), getColCount(), result_set_, EmbeddedDatabase::sqlToColumnType(), and EmbeddedDatabase::UNKNOWN.

Referenced by EmbeddedDatabase::Cursor::getColType().

64  {
65  if (col_num < getColCount()) {
66  SQLTypeInfo type_info = result_set_->getColType(col_num);
67  return sqlToColumnType(type_info.get_type());
68  }
69  return ColumnType::UNKNOWN;
70  }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
ColumnType sqlToColumnType(const SQLTypes &type)
Definition: DBETypes.cpp:111
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Row EmbeddedDatabase::CursorImpl::getNextRow ( )
inline

Definition at line 56 of file DBEngine.cpp.

References result_set_.

Referenced by EmbeddedDatabase::Cursor::getNextRow().

56  {
57  if (result_set_) {
58  auto row = result_set_->getNextRow(true, false);
59  return row.empty() ? Row() : Row(row);
60  }
61  return Row();
62  }
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90

+ Here is the caller graph for this function:

size_t EmbeddedDatabase::CursorImpl::getRowCount ( )
inline

Definition at line 54 of file DBEngine.cpp.

References result_set_.

Referenced by getArrowRecordBatch(), and EmbeddedDatabase::Cursor::getRowCount().

54 { return result_set_ ? result_set_->rowCount() : 0; }
std::shared_ptr< ResultSet > result_set_
Definition: DBEngine.cpp:90

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<std::string> EmbeddedDatabase::CursorImpl::col_names_
private

Definition at line 91 of file DBEngine.cpp.

Referenced by getArrowRecordBatch(), and ~CursorImpl().

std::shared_ptr<arrow::RecordBatch> EmbeddedDatabase::CursorImpl::record_batch_
private

Definition at line 92 of file DBEngine.cpp.

Referenced by getArrowRecordBatch(), and ~CursorImpl().

std::shared_ptr<ResultSet> EmbeddedDatabase::CursorImpl::result_set_
private

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