|
lintel 0.2.0
|
#include <Cursor.h>
Public Member Functions | |
| Cursor (const Connection &connection, const std::string &query, const std::vector< std::string > ¶ms) | |
| Cursor (const Connection &connection, const std::string &query, const std::vector< std::string > ¶ms, std::size_t fetchSize, const std::string &cursorName, bool noScroll) | |
| Cursor (Cursor &cursor)=delete | |
| ~Cursor () | |
| std::vector< db::Arguments > | fetchNext (std::size_t maxRows) |
Forward-only cursor over a PostgreSQL query result.
Two modes:
fetchSize rows per round-trip. Enables FOR UPDATE locking across multiple fetches.The underlying Connection must outlive the cursor and must not run other queries while the cursor is active. The destructor closes (server-side) or drains (streaming) to leave the connection clean.
|
explicit |
Streaming constructor (single-row mode, no DECLARE CURSOR).
| connection | the PostgreSQL connection (must outlive the cursor) |
| query | the SQL query with $1, $2, ... placeholders |
| params | the parameter values to bind |
| db::SQLException | if sending the query or switching to single-row mode fails |
|
explicit |
Server-side cursor constructor (DECLARE CURSOR / FETCH / CLOSE).
| connection | the PostgreSQL connection (must outlive the cursor) |
| query | the SQL query with $1, $2, ... placeholders |
| params | the parameter values to bind |
| fetchSize | number of rows per FETCH (must be > 0) |
| cursorName | the cursor name; if empty a name is generated |
| noScroll | if true the cursor is declared NO SCROLL |
| db::SQLException | if DECLARE CURSOR fails |
|
delete |
| lintel::postgresql::Cursor::~Cursor | ( | ) |
Destructor, closes or drains pending results.
| std::vector< db::Arguments > lintel::postgresql::Cursor::fetchNext | ( | std::size_t | maxRows | ) |
Fetches up to maxRows further rows from the query.
| maxRows | maximum number of rows to fetch (must be > 0) |
| db::SQLException | on server-side failure |