OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 94 of file ResultSet.h.

Member Typedef Documentation

using ResultSetRowIterator::difference_type = std::ptrdiff_t

Definition at line 97 of file ResultSet.h.

using ResultSetRowIterator::iterator_category = std::input_iterator_tag

Definition at line 100 of file ResultSet.h.

Definition at line 98 of file ResultSet.h.

Definition at line 99 of file ResultSet.h.

Definition at line 96 of file ResultSet.h.

Constructor & Destructor Documentation

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

Definition at line 132 of file ResultSet.h.

135  : result_set_(rs)
136  , crt_row_buff_idx_(0)
137  , global_entry_idx_(0)
138  , global_entry_idx_valid_(false)
139  , fetched_so_far_(0)
140  , translate_strings_(translate_strings)
double decimal_to_double(const SQLTypeInfo &otype, int64_t oval)
const ResultSet * result_set_
Definition: ResultSet.h:124
size_t global_entry_idx_
Definition: ResultSet.h:126
size_t crt_row_buff_idx_
Definition: ResultSet.h:125
bool global_entry_idx_valid_
Definition: ResultSet.h:127
ResultSetRowIterator::ResultSetRowIterator ( const ResultSet rs)
inlineprivate

Definition at line 143 of file ResultSet.h.

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

Member Function Documentation

size_t ResultSetRowIterator::getCurrentRowBufferIndex ( ) const
inline

Definition at line 116 of file ResultSet.h.

References crt_row_buff_idx_.

116  {
117  if (crt_row_buff_idx_ == 0) {
118  throw std::runtime_error("current row buffer iteration index is undefined");
119  }
120  return crt_row_buff_idx_ - 1;
121  }
size_t crt_row_buff_idx_
Definition: ResultSet.h:125
bool ResultSetRowIterator::operator!= ( const ResultSetRowIterator other) const
inline

Definition at line 106 of file ResultSet.h.

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

Definition at line 1008 of file ResultSet.h.

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

1008  {
1009  if (!global_entry_idx_valid_) {
1010  return {};
1011  }
1012 
1013  if (result_set_->just_explain_) {
1014  return {result_set_->explanation_};
1015  }
1016 
1017  return result_set_->getRowAt(
1019 }
const ResultSet * result_set_
Definition: ResultSet.h:124
size_t global_entry_idx_
Definition: ResultSet.h:126
bool global_entry_idx_valid_
Definition: ResultSet.h:127
ResultSetRowIterator & ResultSetRowIterator::operator++ ( void  )
inline

Definition at line 1021 of file ResultSet.h.

References fetched_so_far_, global_entry_idx_valid_, and result_set_.

1021  {
1022  if (!result_set_->storage_ && !result_set_->just_explain_) {
1023  global_entry_idx_valid_ = false;
1024  } else if (result_set_->just_explain_) {
1026  fetched_so_far_ = 1;
1027  } else {
1028  result_set_->advanceCursorToNextEntry(*this);
1029  }
1030  return *this;
1031 }
const ResultSet * result_set_
Definition: ResultSet.h:124
bool global_entry_idx_valid_
Definition: ResultSet.h:127
ResultSetRowIterator ResultSetRowIterator::operator++ ( int  )
inline

Definition at line 110 of file ResultSet.h.

110  {
111  ResultSetRowIterator iter(*this);
112  ++(*this);
113  return iter;
114  }
bool ResultSetRowIterator::operator== ( const ResultSetRowIterator other) const
inline

Definition at line 102 of file ResultSet.h.

References crt_row_buff_idx_, and result_set_.

102  {
103  return result_set_ == other.result_set_ &&
105  }
const ResultSet * result_set_
Definition: ResultSet.h:124
size_t crt_row_buff_idx_
Definition: ResultSet.h:125

Friends And Related Function Documentation

friend class ResultSet
friend

Definition at line 143 of file ResultSet.h.

Member Data Documentation

size_t ResultSetRowIterator::crt_row_buff_idx_
private

Definition at line 125 of file ResultSet.h.

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

bool ResultSetRowIterator::decimal_to_double_
private

Definition at line 130 of file ResultSet.h.

Referenced by operator*().

size_t ResultSetRowIterator::fetched_so_far_
private

Definition at line 128 of file ResultSet.h.

Referenced by operator++().

size_t ResultSetRowIterator::global_entry_idx_
private

Definition at line 126 of file ResultSet.h.

Referenced by operator*().

bool ResultSetRowIterator::global_entry_idx_valid_
private

Definition at line 127 of file ResultSet.h.

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

const ResultSet* ResultSetRowIterator::result_set_
private

Definition at line 124 of file ResultSet.h.

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

bool ResultSetRowIterator::translate_strings_
private

Definition at line 129 of file ResultSet.h.

Referenced by operator*().


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