|
lintel 0.2.0
|
#include <Cursor.h>
Classes | |
| class | Iterator |
Public Member Functions | |
| Cursor ()=default | |
| Cursor & | setFetchSize (std::size_t rows) |
| Cursor & | setCursorName (const std::string &name) |
| Cursor & | setNoScroll (bool enable) |
| std::vector< db::Arguments > | fetchNext (std::size_t maxRows) |
| Iterator | begin () |
| Iterator | end () |
Friends | |
| class | Statement |
Forward-only cursor over a query result.
Two modes controlled by fetchSize:
The cursor is single-pass: iterate it once with begin()/end(), or consume it with fetchNext(). The underlying Connection must outlive the cursor.
Configuration (setFetchSize / setCursorName / setNoScroll) must be called before the first call to begin() or fetchNext().
|
default |
Default constructor, creates an exhausted cursor.
| Iterator lintel::db::Cursor::begin | ( | ) |
Starts the stream and returns an iterator to the first row.
| Iterator lintel::db::Cursor::end | ( | ) |
| std::vector< db::Arguments > lintel::db::Cursor::fetchNext | ( | std::size_t | maxRows | ) |
Fetches up to maxRows further rows from the stream.
| maxRows | maximum number of rows to fetch (must be > 0) |
Sets the server-side cursor name. If empty (default), a unique name is auto-generated. Must be called before begin() or fetchNext().
| Cursor & lintel::db::Cursor::setFetchSize | ( | std::size_t | rows | ) |
Sets the number of rows fetched per backend round-trip. 0 = client-side streaming (PQsetSingleRowMode on PG, no DECLARE CURSOR) >0 = server-side cursor (DECLARE/FETCH/CLOSE on PG, prefetch buffer on SQLite) Default: 100 (server-side). Must be called before begin() or fetchNext().
Sets the NO SCROLL flag on the server-side cursor. Default: true (NO SCROLL). Must be called before begin() or fetchNext().