lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
lintel::sqlite::Cursor Class Reference

#include <Cursor.h>

Public Member Functions

 Cursor (const Connection &connection, const std::string &query, const std::vector< std::string > &params, std::size_t fetchSize=kDefaultFetchSize)
 
 Cursor (Cursor &cursor)=delete
 
 ~Cursor ()
 
std::vector< db::Arguments > fetchNext (std::size_t maxRows)
 

Static Public Attributes

static constexpr std::size_t kDefaultFetchSize = 64
 

Detailed Description

Forward-only cursor over an SQLite query result. Rows are fetched lazily via sqlite3_step() instead of buffering the whole result set. The cursor owns its statement and finalizes it on destruction; the underlying Connection must outlive the cursor.

The fetchSize parameter controls the client-side prefetch buffer size (how many rows are buffered per fetchNext() call). SQLite has no server-side cursor concept, so fetchSize only affects client memory usage, not server behaviour.

Constructor & Destructor Documentation

◆ Cursor() [1/2]

lintel::sqlite::Cursor::Cursor ( const Connection &  connection,
const std::string &  query,
const std::vector< std::string > &  params,
std::size_t  fetchSize = kDefaultFetchSize 
)
explicit

Prepares and binds the query for streaming execution.

Parameters
connectionthe SQLite connection (must outlive the cursor)
querythe SQL query with '?' placeholders
paramsthe parameter values to bind
fetchSizeclient-side prefetch buffer size (default 64)
Exceptions
db::SQLExceptionon prepare or bind failure

◆ Cursor() [2/2]

lintel::sqlite::Cursor::Cursor ( Cursor &  cursor)
delete

◆ ~Cursor()

lintel::sqlite::Cursor::~Cursor ( )

Destructor, finalizes the statement.

Member Function Documentation

◆ fetchNext()

std::vector< db::Arguments > lintel::sqlite::Cursor::fetchNext ( std::size_t  maxRows)

Fetches up to maxRows further rows from the query. Internally buffers up to fetchSize rows per sqlite3_step() call.

Parameters
maxRowsmaximum number of rows to fetch (must be > 0)
Returns
the fetched rows; fewer rows than requested means the result set is exhausted
Exceptions
db::SQLExceptionon step failure

Member Data Documentation

◆ kDefaultFetchSize

constexpr std::size_t lintel::sqlite::Cursor::kDefaultFetchSize = 64
staticconstexpr

Default client-side prefetch buffer size


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