OmniSciDB  b24e664e58
 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 235 of file ResultSet.h.

Member Typedef Documentation

using ResultSetRowIterator::difference_type = std::ptrdiff_t

Definition at line 238 of file ResultSet.h.

using ResultSetRowIterator::iterator_category = std::input_iterator_tag

Definition at line 241 of file ResultSet.h.

Definition at line 239 of file ResultSet.h.

Definition at line 240 of file ResultSet.h.

Definition at line 237 of file ResultSet.h.

Constructor & Destructor Documentation

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

Definition at line 273 of file ResultSet.h.

276  : result_set_(rs)
277  , crt_row_buff_idx_(0)
278  , global_entry_idx_(0)
279  , global_entry_idx_valid_(false)
280  , fetched_so_far_(0)
281  , translate_strings_(translate_strings)
double decimal_to_double(const SQLTypeInfo &otype, int64_t oval)
const ResultSet * result_set_
Definition: ResultSet.h:265
size_t global_entry_idx_
Definition: ResultSet.h:267
size_t crt_row_buff_idx_
Definition: ResultSet.h:266
bool global_entry_idx_valid_
Definition: ResultSet.h:268
ResultSetRowIterator::ResultSetRowIterator ( const ResultSet rs)
inlineprivate

Definition at line 284 of file ResultSet.h.

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

Member Function Documentation

size_t ResultSetRowIterator::getCurrentRowBufferIndex ( ) const
inline

Definition at line 257 of file ResultSet.h.

References crt_row_buff_idx_.

257  {
258  if (crt_row_buff_idx_ == 0) {
259  throw std::runtime_error("current row buffer iteration index is undefined");
260  }
261  return crt_row_buff_idx_ - 1;
262  }
size_t crt_row_buff_idx_
Definition: ResultSet.h:266
bool ResultSetRowIterator::operator!= ( const ResultSetRowIterator other) const
inline

Definition at line 247 of file ResultSet.h.

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

Definition at line 854 of file ResultSet.h.

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

854  {
856  return {};
857  }
858 
859  if (result_set_->just_explain_) {
860  return {result_set_->explanation_};
861  }
862 
863  return result_set_->getRowAt(
865 }
const ResultSet * result_set_
Definition: ResultSet.h:265
size_t global_entry_idx_
Definition: ResultSet.h:267
bool global_entry_idx_valid_
Definition: ResultSet.h:268
ResultSetRowIterator & ResultSetRowIterator::operator++ ( void  )
inline

Definition at line 867 of file ResultSet.h.

References fetched_so_far_, global_entry_idx_valid_, and result_set_.

867  {
868  if (!result_set_->storage_ && !result_set_->just_explain_) {
869  global_entry_idx_valid_ = false;
870  } else if (result_set_->just_explain_) {
872  fetched_so_far_ = 1;
873  } else {
874  result_set_->advanceCursorToNextEntry(*this);
875  }
876  return *this;
877 }
const ResultSet * result_set_
Definition: ResultSet.h:265
bool global_entry_idx_valid_
Definition: ResultSet.h:268
ResultSetRowIterator ResultSetRowIterator::operator++ ( int  )
inline

Definition at line 251 of file ResultSet.h.

251  {
252  ResultSetRowIterator iter(*this);
253  ++(*this);
254  return iter;
255  }
bool ResultSetRowIterator::operator== ( const ResultSetRowIterator other) const
inline

Definition at line 243 of file ResultSet.h.

References crt_row_buff_idx_, and result_set_.

243  {
244  return result_set_ == other.result_set_ &&
246  }
const ResultSet * result_set_
Definition: ResultSet.h:265
size_t crt_row_buff_idx_
Definition: ResultSet.h:266

Friends And Related Function Documentation

friend class ResultSet
friend

Definition at line 284 of file ResultSet.h.

Member Data Documentation

size_t ResultSetRowIterator::crt_row_buff_idx_
private

Definition at line 266 of file ResultSet.h.

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

bool ResultSetRowIterator::decimal_to_double_
private

Definition at line 271 of file ResultSet.h.

Referenced by operator*().

size_t ResultSetRowIterator::fetched_so_far_
private

Definition at line 269 of file ResultSet.h.

Referenced by operator++().

size_t ResultSetRowIterator::global_entry_idx_
private

Definition at line 267 of file ResultSet.h.

Referenced by operator*().

bool ResultSetRowIterator::global_entry_idx_valid_
private

Definition at line 268 of file ResultSet.h.

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

const ResultSet* ResultSetRowIterator::result_set_
private

Definition at line 265 of file ResultSet.h.

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

bool ResultSetRowIterator::translate_strings_
private

Definition at line 270 of file ResultSet.h.

Referenced by operator*().


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