Lightweight 0.20260617.0
Loading...
Searching...
No Matches
Lightweight::SqlDataBinderCallback Class Referenceabstract

#include <Core.hpp>

Inheritance diagram for Lightweight::SqlDataBinderCallback:
Lightweight::SqlStatement

Public Member Functions

 SqlDataBinderCallback ()=default
 Default constructor.
 
 SqlDataBinderCallback (SqlDataBinderCallback &&)=default
 Default move constructor.
 
 SqlDataBinderCallback (SqlDataBinderCallback const &)=default
 Default copy constructor.
 
SqlDataBinderCallbackoperator= (SqlDataBinderCallback &&)=default
 Default move assignment operator.
 
SqlDataBinderCallbackoperator= (SqlDataBinderCallback const &)=default
 Default copy assignment operator.
 
virtual void PlanPostExecuteCallback (std::function< void()> &&)=0
 
virtual void PlanPostProcessOutputColumn (std::function< void()> &&)=0
 
virtual SQLLEN * ProvideInputIndicator ()=0
 
virtual SQLLEN * ProvideInputIndicators (size_t rowCount)=0
 
virtual std::byte * ProvideBatchStagingBuffer (std::size_t byteCount)=0
 
virtual SqlServerType ServerType () const noexcept=0
 
virtual std::string const & DriverName () const noexcept=0
 

Detailed Description

Callback interface for SqlDataBinder to allow post-processing of output columns.

This is needed because the SQLBindCol() function does not allow to specify a callback function to be called after the data has been fetched from the database. This is needed to trim strings to the correct size, for example.

Definition at line 35 of file Core.hpp.

Member Function Documentation

◆ PlanPostExecuteCallback()

virtual void Lightweight::SqlDataBinderCallback::PlanPostExecuteCallback ( std::function< void()> &&  )
pure virtual

Plans a callback to be called after the statement has been executed.

See also
SqlDataBinder::PostExecute()

◆ PlanPostProcessOutputColumn()

virtual void Lightweight::SqlDataBinderCallback::PlanPostProcessOutputColumn ( std::function< void()> &&  )
pure virtual

Plans a callback to be called after a column has been processed.

See also
SqlDataBinder::PostProcessOutputColumn()

◆ ProvideInputIndicator()

virtual SQLLEN * Lightweight::SqlDataBinderCallback::ProvideInputIndicator ( )
pure virtual

Provides a pointer to a single indicator for a single input parameter.

Note
The caller is responsible for filling the indicator with the length of the data or SQL_NULL_DATA.
The indicator must remain valid until the statement is executed.
Returns
A pointer to the indicator.

◆ ProvideInputIndicators()

virtual SQLLEN * Lightweight::SqlDataBinderCallback::ProvideInputIndicators ( size_t  rowCount)
pure virtual

Provides a pointer to a contiguous array of indicators for a batch of input parameters.

Note
The caller is responsible for filling the indicators with the lengths of the data or SQL_NULL_DATA.
The indicators must remain valid until the statement is executed.
Parameters
rowCountThe number of rows in the batch.
Returns
A pointer to the first element of the indicator array.

◆ ProvideBatchStagingBuffer()

virtual std::byte * Lightweight::SqlDataBinderCallback::ProvideBatchStagingBuffer ( std::size_t  byteCount)
pure virtual

Provides a pointer to a contiguous, suitably aligned temporary byte buffer that remains valid until the statement is executed.

This is used by batch input parameter binders that need scratch storage whose lifetime must outlive the bind call but not the execution — for example a row-strided NULL/length indicator array used by native row-wise array binding of std::optional columns.

Note
The buffer contents are unspecified; the caller is responsible for initializing it.
The returned storage is aligned to at least alignof(std::max_align_t).
Row-wise callers request ~rowStride*rowCount bytes to hold only rowCount SQLLEN indicators. This over-allocation is intrinsic to ODBC row-wise binding, which strides the StrLen_or_IndPtr array by SQL_ATTR_PARAM_BIND_TYPE (the row stride) — there is no separate indicator stride — so a tightly packed indicator array would require descriptor-level binding.
Parameters
byteCountThe number of bytes to provide.
Returns
A pointer to the first byte of the buffer.

◆ ServerType()

virtual SqlServerType Lightweight::SqlDataBinderCallback::ServerType ( ) const
pure virtualnoexcept
Returns
The server type of the database.

◆ DriverName()

virtual std::string const & Lightweight::SqlDataBinderCallback::DriverName ( ) const
pure virtualnoexcept
Returns
The driver name of the database.

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