OmniSciDB  085a039ca4
 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 42 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 44 of file DBEngine.cpp.

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

Definition at line 47 of file DBEngine.cpp.

References col_names_, record_batch_, and result_set_.

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

Member Function Documentation

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

Definition at line 73 of file DBEngine.cpp.

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

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

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

+ 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 53 of file DBEngine.cpp.

References result_set_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 65 of file DBEngine.cpp.

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

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

65  {
66  if (col_num < getColCount()) {
67  SQLTypeInfo type_info = result_set_->getColType(col_num);
68  return sqlToColumnType(type_info.get_type());
69  }
70  return ColumnType::UNKNOWN;
71  }
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:91

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Row EmbeddedDatabase::CursorImpl::getNextRow ( )
inline

Definition at line 57 of file DBEngine.cpp.

References result_set_.

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

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

+ Here is the caller graph for this function:

size_t EmbeddedDatabase::CursorImpl::getRowCount ( )
inline

Definition at line 55 of file DBEngine.cpp.

References result_set_.

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

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

+ Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 92 of file DBEngine.cpp.

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

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

Definition at line 93 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: