The statement operations a driver provides, as free functions found by argument-dependent lookup on its statement handle struct.
More...
template<typename D>
D::Statement const& constStmt,
D::Connection const& connection,
std::string_view query,
bool wideQueryText,
SqlColumnIndex column,
std::int16_t& count,
std::ptrdiff_t& rowCount,
std::chrono::seconds timeout,
std::chrono::seconds& timeoutOut,
SqlResult result,
std::source_location location,
SqlCatalogRequest const& catalogRequest,
int catalogDataType,
SqlColumnDescription& description,
SqlOutputColumnLength length,
std::uint16_t parameter,
char16_t* utf16Text,
std::size_t columnSize,
SqlIndicator& lengthIndicator) {
{
Allocate(connection, stmt) } -> std::same_as<SqlResult>;
{
Free(stmt) } -> std::same_as<void>;
{ Abandon(stmt) } -> std::same_as<void>;
{
Prepare(stmt, query, wideQueryText) } -> std::same_as<SqlResult>;
{
Execute(stmt) } -> std::same_as<SqlResult>;
{
ExecuteDirect(stmt, query, wideQueryText) } -> std::same_as<SqlResult>;
{
Fetch(stmt) } -> std::same_as<SqlResult>;
{
ColumnType(constStmt, column) } -> std::same_as<std::expected<SqlResultColumnType, SqlErrorInfo>>;
{
QueryTimeout(constStmt, timeoutOut) } -> std::same_as<SqlResult>;
{
Diagnose(constStmt) } -> std::same_as<SqlErrorInfo>;
{
RequireSuccess(constStmt, result, location) } -> std::same_as<void>;
{
CheckResult(constStmt, result, location) } -> std::same_as<CallOutcome>;
{
OpenCatalog(constStmt, catalogRequest) } -> std::same_as<SqlResult>;
{
CatalogColumnType(constStmt, catalogDataType) } -> std::same_as<SqlResultColumnType>;
{
DescribeColumn(constStmt, column, description) } -> std::same_as<SqlResult>;
{
BindUtf16TextParameter(stmt, parameter, utf16Text, columnSize, lengthIndicator) } -> std::same_as<SqlResult>;
}
void ResetParameterArrays(StatementHandle &statement) noexcept
Restores single-row parameter binding after a parameter-array execution. Not reported.
void CloseCursor(StatementHandle &statement) noexcept
Closes the cursor of a result set that was read to its end. Pending result sets are left alone.
SqlResult UnbindColumns(StatementHandle &statement) noexcept
Unbinds every bound result column.
std::optional< std::int16_t > DescribeResultColumnSqlType(StatementHandle const &statement, SqlColumnIndex column) noexcept
The driver's own SQL type code of a result column, as the driver's leaf binders read it (see SqlDataB...
void Allocate(ConnectionHandle &connection) noexcept
Allocates the driver's connection resources, unless the connection already holds them.
void RequireSuccess(StatementHandle const &statement, SqlResult result, std::source_location location=std::source_location::current())
Throws unless result indicates success: std::invalid_argument for a soft failure the caller is expect...
SqlResult NumResultColumns(StatementHandle const &statement, std::int16_t &count) noexcept
Reports the number of columns of the current result set.
SqlResult SetQueryTimeout(StatementHandle &statement, std::chrono::seconds timeout) noexcept
Sets the query timeout of the statement.
void DiscardResults(StatementHandle &statement) noexcept
Drains every pending result set and closes the cursor, so the handle can run another query....
void Free(StatementHandle &statement) noexcept
Frees the statement's driver handle and leaves statement empty, bound to the same driver.
SqlResult OpenCatalog(StatementHandle const &statement, SqlCatalogRequest const &request)
Opens the catalog result set request names on statement, in the layout the ODBC specification gives t...
SqlResult NumParameters(StatementHandle const &statement, std::int16_t &count) noexcept
Reports the number of parameters of the prepared statement.
SqlResultColumnType CatalogColumnType(StatementHandle const &statement, int dataType) noexcept
The type a DATA_TYPE code of the driver's catalog result sets (see OpenCatalog) stands for.
SqlResult QueryTimeout(StatementHandle const &statement, std::chrono::seconds &timeout) noexcept
Reports the query timeout of the statement.
void ResetRowArrayAttributes(StatementHandle &statement) noexcept
Restores single-row fetching after a row-array fetch. Not reported; nothing for a driver without row ...
SqlResult NumRowsAffected(StatementHandle const &statement, std::ptrdiff_t &count) noexcept
Reports the number of rows the last executed statement affected.
std::size_t DeclaredBoundColumnSize(StatementHandle const &statement, SqlColumnIndex column, SqlOutputColumnLength length) noexcept
The declared length of a result column as a bound buffer size (see SqlDataBinderCallback::MinimumOutp...
SqlErrorInfo Diagnose(StatementHandle const &statement)
Reads the statement's diagnostics: the first record its last failed call left.
SqlResult DescribeColumn(StatementHandle const &statement, SqlColumnIndex column, SqlColumnDescription &description)
Describes a result column: its type and its size.
SqlResult ResetParameters(StatementHandle &statement) noexcept
Drops every parameter binding.
std::expected< SqlResultColumnType, SqlErrorInfo > ColumnType(StatementHandle const &statement, SqlColumnIndex column)
The SQL data type of a result column, as the driver describes it.
SqlResult MoreResults(StatementHandle &statement) noexcept
Advances to the next pending result set.
CallOutcome CheckResult(StatementHandle const &statement, SqlResult result, std::source_location location)
The non-throwing, fault-seam-aware verdict on result.
LIGHTWEIGHT_FORCE_INLINE SqlResult BindUtf16TextParameter(Statement &stmt, std::uint16_t parameter, char16_t *text, std::size_t columnSize, SqlIndicator &lengthIndicator) noexcept
Binds UTF-16 text as an input parameter of SQL type SQL_WVARCHAR (SQLBindParameter with SQL_C_WCHAR)....
The statement operations a driver provides, as free functions found by argument-dependent lookup on i...
@ Execute
The execution of a prepared statement (SqlStatement::Execute).
@ ExecuteDirect
The execution of a one-shot statement (SqlStatement::ExecuteDirect).
@ Prepare
The preparation of a statement (SqlStatement::Prepare).
The statement operations a driver provides, as free functions found by argument-dependent lookup on its statement handle struct.
Each returns the driver's result code rather than throwing, so the caller decides how to check it; Diagnose, RequireSuccess and CheckResult are the driver's ways of checking one.
Catalog access is part of it, so that the schema reader compiles against every driver without naming one: OpenCatalog opens the result set of a Lightweight::Driver::SqlCatalogRequest in ODBC's catalog layout, and CatalogColumnType reads that layout's type codes. A driver without catalog functions (HasCatalogFunctions is false) implements both with the one "not supported by this driver" error (SQLSTATE IM001) and the type Unknown; SqlSchema never calls them on it, since it reads that driver's catalog with the SQL of SqlQueryFormatter::CatalogQueries(). Likewise each operation a driver has no data for answers with that error or the stated neutral value (no SQL type code, the default bound size, nothing to reset), never by being absent: shared code calls every operation unconditionally.
Definition at line 210 of file Concept.hpp.