OmniSciDB  04ee39c94c
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 242 of file ResultSet.h.

Member Typedef Documentation

◆ difference_type

using ResultSetRowIterator::difference_type = std::ptrdiff_t

Definition at line 245 of file ResultSet.h.

◆ iterator_category

using ResultSetRowIterator::iterator_category = std::input_iterator_tag

Definition at line 248 of file ResultSet.h.

◆ pointer

Definition at line 246 of file ResultSet.h.

◆ reference

Definition at line 247 of file ResultSet.h.

◆ value_type

Definition at line 244 of file ResultSet.h.

Constructor & Destructor Documentation

◆ ResultSetRowIterator() [1/2]

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

Definition at line 280 of file ResultSet.h.

283  : result_set_(rs)
284  , crt_row_buff_idx_(0)
285  , global_entry_idx_(0)
286  , global_entry_idx_valid_(false)
287  , fetched_so_far_(0)
288  , translate_strings_(translate_strings)
double decimal_to_double(const SQLTypeInfo &otype, int64_t oval)
const ResultSet * result_set_
Definition: ResultSet.h:272
size_t global_entry_idx_
Definition: ResultSet.h:274
size_t crt_row_buff_idx_
Definition: ResultSet.h:273
bool global_entry_idx_valid_
Definition: ResultSet.h:275

◆ ResultSetRowIterator() [2/2]

ResultSetRowIterator::ResultSetRowIterator ( const ResultSet rs)
inlineprivate

Definition at line 291 of file ResultSet.h.

References ResultSetStorage::ResultSet.

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

Member Function Documentation

◆ getCurrentRowBufferIndex()

size_t ResultSetRowIterator::getCurrentRowBufferIndex ( ) const
inline

Definition at line 264 of file ResultSet.h.

264  {
265  if (crt_row_buff_idx_ == 0) {
266  throw std::runtime_error("current row buffer iteration index is undefined");
267  }
268  return crt_row_buff_idx_ - 1;
269  }
size_t crt_row_buff_idx_
Definition: ResultSet.h:273

◆ operator!=()

bool ResultSetRowIterator::operator!= ( const ResultSetRowIterator other) const
inline

Definition at line 254 of file ResultSet.h.

254 { return !(*this == other); }

◆ operator*()

ResultSetRowIterator::value_type ResultSetRowIterator::operator* ( ) const
inline

Definition at line 848 of file ResultSet.h.

848  {
850  return {};
851  }
852 
853  if (result_set_->just_explain_) {
854  return {result_set_->explanation_};
855  }
856 
857  return result_set_->getRowAt(
859 }
const ResultSet * result_set_
Definition: ResultSet.h:272
size_t global_entry_idx_
Definition: ResultSet.h:274
bool global_entry_idx_valid_
Definition: ResultSet.h:275

◆ operator++() [1/2]

ResultSetRowIterator & ResultSetRowIterator::operator++ ( void  )
inline

Definition at line 861 of file ResultSet.h.

861  {
862  if (!result_set_->storage_ && !result_set_->just_explain_) {
863  global_entry_idx_valid_ = false;
864  } else if (result_set_->just_explain_) {
866  fetched_so_far_ = 1;
867  } else {
868  result_set_->advanceCursorToNextEntry(*this);
869  }
870  return *this;
871 }
const ResultSet * result_set_
Definition: ResultSet.h:272
bool global_entry_idx_valid_
Definition: ResultSet.h:275

◆ operator++() [2/2]

ResultSetRowIterator ResultSetRowIterator::operator++ ( int  )
inline

Definition at line 258 of file ResultSet.h.

258  {
259  ResultSetRowIterator iter(*this);
260  ++(*this);
261  return iter;
262  }

◆ operator==()

bool ResultSetRowIterator::operator== ( const ResultSetRowIterator other) const
inline

Definition at line 250 of file ResultSet.h.

References crt_row_buff_idx_, and result_set_.

250  {
251  return result_set_ == other.result_set_ &&
253  }
const ResultSet * result_set_
Definition: ResultSet.h:272
size_t crt_row_buff_idx_
Definition: ResultSet.h:273

Friends And Related Function Documentation

◆ ResultSet

friend class ResultSet
friend

Definition at line 291 of file ResultSet.h.

Member Data Documentation

◆ crt_row_buff_idx_

size_t ResultSetRowIterator::crt_row_buff_idx_
private

Definition at line 273 of file ResultSet.h.

Referenced by ResultSet::advanceCursorToNextEntry(), and operator==().

◆ decimal_to_double_

bool ResultSetRowIterator::decimal_to_double_
private

Definition at line 278 of file ResultSet.h.

◆ fetched_so_far_

size_t ResultSetRowIterator::fetched_so_far_
private

Definition at line 276 of file ResultSet.h.

Referenced by ResultSet::advanceCursorToNextEntry().

◆ global_entry_idx_

size_t ResultSetRowIterator::global_entry_idx_
private

Definition at line 274 of file ResultSet.h.

Referenced by ResultSet::advanceCursorToNextEntry().

◆ global_entry_idx_valid_

bool ResultSetRowIterator::global_entry_idx_valid_
private

Definition at line 275 of file ResultSet.h.

Referenced by ResultSet::advanceCursorToNextEntry().

◆ result_set_

const ResultSet* ResultSetRowIterator::result_set_
private

Definition at line 272 of file ResultSet.h.

Referenced by operator==().

◆ translate_strings_

bool ResultSetRowIterator::translate_strings_
private

Definition at line 277 of file ResultSet.h.


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