OmniSciDB  0fdbebe030
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResultSetRowIterator Class Reference

#include <ResultSet.h>

+ Collaboration diagram for ResultSetRowIterator:

Public Types

using value_type = std::vector< TargetValue >
 
using difference_type = std::ptrdiff_t
 
using pointer = std::vector< TargetValue > *
 
using reference = std::vector< TargetValue > &
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

bool operator== (const ResultSetRowIterator &other) const
 
bool operator!= (const ResultSetRowIterator &other) const
 
value_type operator* () const
 
ResultSetRowIteratoroperator++ (void)
 
ResultSetRowIterator operator++ (int)
 
size_t getCurrentRowBufferIndex () const
 

Private Member Functions

 ResultSetRowIterator (const ResultSet *rs, bool translate_strings, bool decimal_to_double)
 
 ResultSetRowIterator (const ResultSet *rs)
 

Private Attributes

const ResultSetresult_set_
 
size_t crt_row_buff_idx_
 
size_t global_entry_idx_
 
bool global_entry_idx_valid_
 
size_t fetched_so_far_
 
bool translate_strings_
 
bool decimal_to_double_
 

Friends

class ResultSet
 

Detailed Description

Definition at line 244 of file ResultSet.h.

Member Typedef Documentation

using ResultSetRowIterator::difference_type = std::ptrdiff_t

Definition at line 247 of file ResultSet.h.

using ResultSetRowIterator::iterator_category = std::input_iterator_tag

Definition at line 250 of file ResultSet.h.

Definition at line 248 of file ResultSet.h.

Definition at line 249 of file ResultSet.h.

Definition at line 246 of file ResultSet.h.

Constructor & Destructor Documentation

ResultSetRowIterator::ResultSetRowIterator ( const ResultSet rs,
bool  translate_strings,
bool  decimal_to_double 
)
inlineprivate

Definition at line 282 of file ResultSet.h.

285  : result_set_(rs)
286  , crt_row_buff_idx_(0)
287  , global_entry_idx_(0)
288  , global_entry_idx_valid_(false)
289  , fetched_so_far_(0)
290  , translate_strings_(translate_strings)
double decimal_to_double(const SQLTypeInfo &otype, int64_t oval)
const ResultSet * result_set_
Definition: ResultSet.h:274
size_t global_entry_idx_
Definition: ResultSet.h:276
size_t crt_row_buff_idx_
Definition: ResultSet.h:275
bool global_entry_idx_valid_
Definition: ResultSet.h:277
ResultSetRowIterator::ResultSetRowIterator ( const ResultSet rs)
inlineprivate

Definition at line 293 of file ResultSet.h.

293 : ResultSetRowIterator(rs, false, false){};
ResultSetRowIterator(const ResultSet *rs, bool translate_strings, bool decimal_to_double)
Definition: ResultSet.h:282

Member Function Documentation

size_t ResultSetRowIterator::getCurrentRowBufferIndex ( ) const
inline

Definition at line 266 of file ResultSet.h.

References crt_row_buff_idx_.

266  {
267  if (crt_row_buff_idx_ == 0) {
268  throw std::runtime_error("current row buffer iteration index is undefined");
269  }
270  return crt_row_buff_idx_ - 1;
271  }
size_t crt_row_buff_idx_
Definition: ResultSet.h:275
bool ResultSetRowIterator::operator!= ( const ResultSetRowIterator other) const
inline

Definition at line 256 of file ResultSet.h.

256 { return !(*this == other); }
ResultSetRowIterator::value_type ResultSetRowIterator::operator* ( ) const
inline

Definition at line 868 of file ResultSet.h.

References decimal_to_double_, global_entry_idx_, global_entry_idx_valid_, result_set_, and translate_strings_.

868  {
870  return {};
871  }
872 
873  if (result_set_->just_explain_) {
874  return {result_set_->explanation_};
875  }
876 
877  return result_set_->getRowAt(
879 }
const ResultSet * result_set_
Definition: ResultSet.h:274
size_t global_entry_idx_
Definition: ResultSet.h:276
bool global_entry_idx_valid_
Definition: ResultSet.h:277
ResultSetRowIterator & ResultSetRowIterator::operator++ ( void  )
inline

Definition at line 881 of file ResultSet.h.

References fetched_so_far_, global_entry_idx_valid_, and result_set_.

881  {
882  if (!result_set_->storage_ && !result_set_->just_explain_) {
883  global_entry_idx_valid_ = false;
884  } else if (result_set_->just_explain_) {
886  fetched_so_far_ = 1;
887  } else {
888  result_set_->advanceCursorToNextEntry(*this);
889  }
890  return *this;
891 }
const ResultSet * result_set_
Definition: ResultSet.h:274
bool global_entry_idx_valid_
Definition: ResultSet.h:277
ResultSetRowIterator ResultSetRowIterator::operator++ ( int  )
inline

Definition at line 260 of file ResultSet.h.

260  {
261  ResultSetRowIterator iter(*this);
262  ++(*this);
263  return iter;
264  }
bool ResultSetRowIterator::operator== ( const ResultSetRowIterator other) const
inline

Definition at line 252 of file ResultSet.h.

References crt_row_buff_idx_, and result_set_.

252  {
253  return result_set_ == other.result_set_ &&
255  }
const ResultSet * result_set_
Definition: ResultSet.h:274
size_t crt_row_buff_idx_
Definition: ResultSet.h:275

Friends And Related Function Documentation

friend class ResultSet
friend

Definition at line 293 of file ResultSet.h.

Member Data Documentation

size_t ResultSetRowIterator::crt_row_buff_idx_
private

Definition at line 275 of file ResultSet.h.

Referenced by getCurrentRowBufferIndex(), and operator==().

bool ResultSetRowIterator::decimal_to_double_
private

Definition at line 280 of file ResultSet.h.

Referenced by operator*().

size_t ResultSetRowIterator::fetched_so_far_
private

Definition at line 278 of file ResultSet.h.

Referenced by operator++().

size_t ResultSetRowIterator::global_entry_idx_
private

Definition at line 276 of file ResultSet.h.

Referenced by operator*().

bool ResultSetRowIterator::global_entry_idx_valid_
private

Definition at line 277 of file ResultSet.h.

Referenced by operator*(), and operator++().

const ResultSet* ResultSetRowIterator::result_set_
private

Definition at line 274 of file ResultSet.h.

Referenced by operator*(), operator++(), and operator==().

bool ResultSetRowIterator::translate_strings_
private

Definition at line 279 of file ResultSet.h.

Referenced by operator*().


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