10#include <Pt/Db/ICursor.h>
11#include <Pt/Db/Result.h>
12#include <Pt/SmartPtr.h>
60 typedef std::size_t size_type;
96 {
return _cursor && _cursor->isOpen(); }
112 {
return _cursor.get(); }
117 {
return _cursor.get(); }
133 CursorImplPtr _cursor;
135 size_type _batchSize;
144 using iterator_category = std::forward_iterator_tag;
145 using value_type =
Row;
146 using difference_type = std::ptrdiff_t;
147 using pointer =
const Row*;
148 using reference =
const Row&;
169 {
return ! operator==(other); }
173 const Row& operator*()
const
176 const Row* operator->()
const
177 {
return &_current; }
Forward iterator over the rows of a Cursor.
Definition Cursor.h:142
CursorIterator()
Creates the end sentinel.
Definition Cursor.h:158
CursorIterator(const Cursor &cursor)
Creates an iterator on a cursor that already has a batch.
Batch cursor for large query results.
Definition Cursor.h:58
bool isOpen() const
Returns true if the cursor is open.
Definition Cursor.h:95
Iterator begin()
Returns an iterator to the first row, fetching the first batch.
Signal & fetchFinished()
Signal emitted when an asynchronous batch is ready.
const Result & result() const
Returns the current batch buffer.
Definition Cursor.h:86
void close()
Closes the cursor and releases its resources.
void beginFetch()
Starts asynchronous retrieval of the next batch.
Cursor(ICursor *cursor, size_type batchSize)
Takes ownership of cursor with a fixed batchSize.
Cursor()
Creates a closed cursor.
Definition Cursor.h:65
Iterator end()
Returns the end sentinel iterator.
Result & endFetch()
Completes an asynchronous fetch.
Result & result()
Returns the current batch buffer.
Definition Cursor.h:81
ICursor * impl()
Returns the backend cursor.
Definition Cursor.h:111
bool fetch()
Fetches the next batch synchronously.
const ICursor * impl() const
Returns the backend cursor.
Definition Cursor.h:116
Batch-cursor backend.
Definition ICursor.h:26
Buffered query result with random-access rows.
Definition Result.h:42
One row of a buffered query result.
Definition Row.h:34
Prepared SQL statement with named host variables.
Definition Statement.h:65
Multicast Signal to call multiple slots.
Definition Signal.h:190
Policy based smart pointer.
Definition SmartPtr.h:462
Portable SQL database access.
Core module.
Definition Allocator.h:33