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

Member Typedef Documentation

using ResultSetRowIterator::difference_type = std::ptrdiff_t

Definition at line 245 of file ResultSet.h.

using ResultSetRowIterator::iterator_category = std::input_iterator_tag

Definition at line 248 of file ResultSet.h.

Definition at line 246 of file ResultSet.h.

Definition at line 247 of file ResultSet.h.

Definition at line 244 of file ResultSet.h.

Constructor & Destructor Documentation

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::ResultSetRowIterator ( const ResultSet rs)
inlineprivate

Definition at line 291 of file ResultSet.h.

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

Member Function Documentation

size_t ResultSetRowIterator::getCurrentRowBufferIndex ( ) const
inline

Definition at line 264 of file ResultSet.h.

References crt_row_buff_idx_.

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
bool ResultSetRowIterator::operator!= ( const ResultSetRowIterator other) const
inline

Definition at line 254 of file ResultSet.h.

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

Definition at line 861 of file ResultSet.h.

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

861  {
863  return {};
864  }
865 
866  if (result_set_->just_explain_) {
867  return {result_set_->explanation_};
868  }
869 
870  return result_set_->getRowAt(
872 }
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
ResultSetRowIterator & ResultSetRowIterator::operator++ ( void  )
inline

Definition at line 874 of file ResultSet.h.

References fetched_so_far_, global_entry_idx_valid_, and result_set_.

874  {
875  if (!result_set_->storage_ && !result_set_->just_explain_) {
876  global_entry_idx_valid_ = false;
877  } else if (result_set_->just_explain_) {
879  fetched_so_far_ = 1;
880  } else {
881  result_set_->advanceCursorToNextEntry(*this);
882  }
883  return *this;
884 }
const ResultSet * result_set_
Definition: ResultSet.h:272
bool global_entry_idx_valid_
Definition: ResultSet.h:275
ResultSetRowIterator ResultSetRowIterator::operator++ ( int  )
inline

Definition at line 258 of file ResultSet.h.

258  {
259  ResultSetRowIterator iter(*this);
260  ++(*this);
261  return iter;
262  }
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

friend class ResultSet
friend

Definition at line 291 of file ResultSet.h.

Member Data Documentation

size_t ResultSetRowIterator::crt_row_buff_idx_
private

Definition at line 273 of file ResultSet.h.

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

bool ResultSetRowIterator::decimal_to_double_
private

Definition at line 278 of file ResultSet.h.

Referenced by operator*().

size_t ResultSetRowIterator::fetched_so_far_
private

Definition at line 276 of file ResultSet.h.

Referenced by operator++().

size_t ResultSetRowIterator::global_entry_idx_
private

Definition at line 274 of file ResultSet.h.

Referenced by operator*().

bool ResultSetRowIterator::global_entry_idx_valid_
private

Definition at line 275 of file ResultSet.h.

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

const ResultSet* ResultSetRowIterator::result_set_
private

Definition at line 272 of file ResultSet.h.

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

bool ResultSetRowIterator::translate_strings_
private

Definition at line 277 of file ResultSet.h.

Referenced by operator*().


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