OmniSciDB  a5dc49c757
 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 43 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 45 of file DBEngine.cpp.

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

Definition at line 48 of file DBEngine.cpp.

References col_names_, record_batch_, and result_set_.

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

Member Function Documentation

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

Definition at line 74 of file DBEngine.cpp.

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

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

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

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

References result_set_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 66 of file DBEngine.cpp.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Row EmbeddedDatabase::CursorImpl::getNextRow ( )
inline

Definition at line 58 of file DBEngine.cpp.

References result_set_.

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

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

+ Here is the caller graph for this function:

size_t EmbeddedDatabase::CursorImpl::getRowCount ( )
inline

Definition at line 56 of file DBEngine.cpp.

References result_set_.

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

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

+ Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 93 of file DBEngine.cpp.

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

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

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