| Qore DbDataProvider Module Reference 2.2

Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
DbDataProvider::DbSelectRecordIterator Class Reference

Defines the record iterator class for Table-based iterators. More...

`#include <DbSelectRecordIterator.qc.dox.h>`

Inheritance diagram for DbDataProvider::DbSelectRecordIterator:
[legend]

## Public Member Functions
| constructor (AbstractDatasource ds, *hash< auto > where_cond, hash< auto > select_options)
| Creates the iterator.
auto | memberGate (string key)
| Returns the value of the given field in the current record, if the iterator is valid.
bool | next ()
| Moves the current position to the next element; returns False if there are no more elements.
Public Member Functions inherited from DbDataProvider::AbstractDbRecordIterator
| constructor (bool release_transaction, AbstractSQLStatement stmt)
| creates the iterator
| destructor ()
| rolls back the transaction if a transaction lock was acquired in the constructor and keepTransactionLock() was not called
*AbstractDataProviderBulkRecordInterface | getBulkApi ()
| Returns the bulk data interface.
*hash< string, AbstractDataField > | getRecordType ()
| Returns the record description, if available.
hash< auto > | getValue ()
| Returns a single record if the iterator is valid.
| keepTransactionLock ()
| Ensures that no rollback is performed when the object is destroyed.
bool | next ()
| Increments the row pointer when retrieving rows from a select statement; returns True if there is a row to retrieve, False if not.
bool | valid ()
| Returns True if the iterator is valid.

## Static Protected Member Functions
static AbstractSQLStatement | prepareStatement (AbstractSQLStatement stmt, hash< auto > select_options)
| Prepares the AbstractSQLStatement object for the iterator.

## Protected Attributes
*hash< auto > | where_cond
| search conditions
Protected Attributes inherited from DbDataProvider::AbstractDbRecordIterator
bool | release_transaction
| release the transaction with a rollback in the destructor?
AbstractSQLStatement | stmt
| the statement being iterated

## Detailed Description

Defines the record iterator class for Table-based iterators.

## Member Function Documentation

## ◆ constructor()

DbDataProvider::DbSelectRecordIterator::constructor | ( | AbstractDatasource | ds,
|  | *hash< auto > | where_cond,
|  | hash< auto > | select_options )

Creates the iterator.

Parameters

  ds | the datasource to use
  where_cond | the search conditions to apply to the result set from the SQL
  search_options | search options; assumed to have already been processed for validity before this call; contains: `sql` (required): the SQL query `args` (optional): a list of bind arguments to sql

## ◆ memberGate()

auto DbDataProvider::DbSelectRecordIterator::memberGate | ( | string | key | ) |

Returns the value of the given field in the current record, if the iterator is valid.

Parameters

  key | the name of the field

Returns
  the value of the given field in the current record, if the iterator is valid

Exceptions

  FIELD-ERROR | invalid or unknown field name

## ◆ next()

bool DbDataProvider::DbSelectRecordIterator::next | ( |  | ) |

Moves the current position to the next element; returns False if there are no more elements.

This method will return True again after it returns False once if the object being iterated is not empty, otherwise it will always return False. The iterator object should not be used after this method returns False

Returns
  False if there are no more elements (in which case the iterator object is invalid and should not be used); True if successful (meaning that the iterator object is valid)