relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
relx::connection::PostgreSQLStreamingSource Class Reference

PostgreSQL streaming data source for processing large result sets. More...

#include <relx/connection/postgresql_streaming_source.hpp>

Public Member Functions

 PostgreSQLStreamingSource (PostgreSQLConnection &connection, std::string sql, std::vector< std::string > params={})
 Constructor with connection and query parameters.
 
 PostgreSQLStreamingSource (PostgreSQLConnection &connection, std::string sql, std::vector< std::string > params, std::vector< bool > is_binary)
 Constructor with connection and binary query parameters.
 
 ~PostgreSQLStreamingSource ()
 Destructor that cleans up any active query.
 
 PostgreSQLStreamingSource (const PostgreSQLStreamingSource &)=delete
 
PostgreSQLStreamingSourceoperator= (const PostgreSQLStreamingSource &)=delete
 
 PostgreSQLStreamingSource (PostgreSQLStreamingSource &&other) noexcept
 
PostgreSQLStreamingSourceoperator= (PostgreSQLStreamingSource &&other) noexcept
 
ConnectionResult< void > initialize ()
 Initialize the streaming query.
 
std::optional< std::string > get_next_row ()
 Get the next row from the result set.
 
const std::vector< std::string > & get_column_names () const
 Get the column names for the result set.
 
bool is_initialized () const
 Check if the streaming source has been initialized.
 
bool has_more_rows () const
 Check if there are more rows available.
 

Detailed Description

PostgreSQL streaming data source for processing large result sets.

This class implements the data source interface required by StreamingResultSet. It uses PostgreSQL's single-row mode to fetch results incrementally, which is ideal for processing large datasets without loading everything into memory.

Definition at line 21 of file postgresql_streaming_source.hpp.

Constructor & Destructor Documentation

◆ PostgreSQLStreamingSource() [1/4]

relx::connection::PostgreSQLStreamingSource::PostgreSQLStreamingSource ( PostgreSQLConnection connection,
std::string  sql,
std::vector< std::string >  params = {} 
)

Constructor with connection and query parameters.

Parameters
connectionPostgreSQL connection to use for queries
sqlThe SQL query string to execute
paramsOptional query parameters

◆ PostgreSQLStreamingSource() [2/4]

relx::connection::PostgreSQLStreamingSource::PostgreSQLStreamingSource ( PostgreSQLConnection connection,
std::string  sql,
std::vector< std::string >  params,
std::vector< bool >  is_binary 
)

Constructor with connection and binary query parameters.

Parameters
connectionPostgreSQL connection to use for queries
sqlThe SQL query string to execute
paramsQuery parameters
is_binaryVector indicating which parameters are binary

◆ ~PostgreSQLStreamingSource()

relx::connection::PostgreSQLStreamingSource::~PostgreSQLStreamingSource ( )

Destructor that cleans up any active query.

◆ PostgreSQLStreamingSource() [3/4]

relx::connection::PostgreSQLStreamingSource::PostgreSQLStreamingSource ( const PostgreSQLStreamingSource )
delete

◆ PostgreSQLStreamingSource() [4/4]

relx::connection::PostgreSQLStreamingSource::PostgreSQLStreamingSource ( PostgreSQLStreamingSource &&  other)
noexcept

Member Function Documentation

◆ get_column_names()

const std::vector< std::string > & relx::connection::PostgreSQLStreamingSource::get_column_names ( ) const

Get the column names for the result set.

Returns
Vector of column names

◆ get_next_row()

std::optional< std::string > relx::connection::PostgreSQLStreamingSource::get_next_row ( )

Get the next row from the result set.

Returns
Optional string containing the next row data, or nullopt if no more rows

Returns row data in the format "col1|col2|col3|..." for compatibility with LazyRow

◆ has_more_rows()

bool relx::connection::PostgreSQLStreamingSource::has_more_rows ( ) const
inline

Check if there are more rows available.

Returns
True if more rows are available, false if end of results or error

Definition at line 68 of file postgresql_streaming_source.hpp.

◆ initialize()

ConnectionResult< void > relx::connection::PostgreSQLStreamingSource::initialize ( )

Initialize the streaming query.

Returns
ConnectionResult indicating success or failure

◆ is_initialized()

bool relx::connection::PostgreSQLStreamingSource::is_initialized ( ) const
inline

Check if the streaming source has been initialized.

Returns
True if initialized, false otherwise

Definition at line 64 of file postgresql_streaming_source.hpp.

◆ operator=() [1/2]

PostgreSQLStreamingSource & relx::connection::PostgreSQLStreamingSource::operator= ( const PostgreSQLStreamingSource )
delete

◆ operator=() [2/2]

PostgreSQLStreamingSource & relx::connection::PostgreSQLStreamingSource::operator= ( PostgreSQLStreamingSource &&  other)
noexcept

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