|
Lightweight 0.20261105.1
|
#include "../../Api.hpp"#include "../../SqlBindingTypes.hpp"#include "../../SqlError.hpp"#include "Diagnostics.hpp"#include "Handles.hpp"#include "SqlOdbcPrelude.hpp"#include <array>#include <chrono>#include <cstddef>#include <cstdint>#include <cstring>#include <expected>#include <optional>#include <source_location>#include <string>#include <string_view>#include <utility>#include <vector>#include <sql.h>#include <sqlext.h>Go to the source code of this file.
Classes | |
| struct | Lightweight::Driver::Odbc::ColumnDescription |
| What DescribeColumn reports about a result column. More... | |
| struct | Lightweight::Driver::Odbc::ParameterArrayLayout |
| The layout of the parameter array that is being bound. More... | |
Typedefs | |
| using | Lightweight::Driver::Odbc::ProcessedCount = SQLULEN |
The count a driver writes back through a parameter-array or row-array attribute pointer (SQL_ATTR_PARAMS_PROCESSED_PTR, SQL_ATTR_ROWS_FETCHED_PTR). | |
| using | Lightweight::Driver::Odbc::RowStatus = SQLUSMALLINT |
One element of a parameter-status or row-status array (SQL_ATTR_PARAM_STATUS_PTR, SQL_ATTR_ROW_STATUS_PTR). | |
Functions | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::Allocate (Connection const &connection, Statement &stmt) noexcept |
Allocates a statement handle on connection. | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::Free (Statement &stmt) noexcept |
Frees the statement handle and leaves stmt empty. | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::Abandon (Statement &stmt) noexcept |
Gives up a statement handle whose connection session ended, and leaves stmt empty. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::Prepare (Statement &stmt, std::string_view query, bool wideQueryText) |
Prepares query on the statement. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::Execute (Statement &stmt) noexcept |
| Executes the prepared statement with the currently bound parameters. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::ExecuteDirect (Statement &stmt, std::string_view query, bool wideQueryText) |
Executes query directly, without preparing it. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::Fetch (Statement &stmt) noexcept |
| Fetches the next row of the result set into the bound columns. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::MoreResults (Statement &stmt) noexcept |
| Advances to the next pending result set. | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::CloseCursor (Statement &stmt) noexcept |
Closes the cursor of a result set that was read to its end (SQLCloseCursor). Pending result sets are left alone; the result is not reported. | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::ReleaseCursor (Statement &stmt) noexcept |
Closes any open cursor and discards its pending rows (SQLFreeStmt with SQL_CLOSE), so the handle can run another query. Pending result sets are left alone; the result is not reported. | |
| void | Lightweight::Driver::Odbc::DiscardResults (Statement &stmt) noexcept |
Drains every pending result set (SQLMoreResults until SQL_NO_DATA or an error), then closes the cursor (ReleaseCursor), so the handle can run another query. An error met while draining ends the drain and is not reported. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::UnbindColumns (Statement &stmt) noexcept |
Unbinds every bound result column (SQLFreeStmt with SQL_UNBIND). | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::ResetParameters (Statement &stmt) noexcept |
Drops every parameter binding (SQLFreeStmt with SQL_RESET_PARAMS). | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::ResetParameterArrays (Statement &stmt) noexcept |
| Restores single-row, column-bound parameter binding (the ODBC default) and unbinds the parameter status and processed-count pointers. The results are not reported: resetting to defaults on a live handle does not meaningfully fail. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::NumResultColumns (Statement const &stmt, std::int16_t &count) noexcept |
| Reports the number of columns of the current result set. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::NumParameters (Statement const &stmt, std::int16_t &count) noexcept |
| Reports the number of parameters of the prepared statement. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::NumRowsAffected (Statement const &stmt, std::ptrdiff_t &count) noexcept |
| Reports the number of rows the last executed statement affected. | |
| LIGHTWEIGHT_API std::expected< std::string, SqlErrorInfo > | Lightweight::Driver::Odbc::ColumnName (Statement const &stmt, SqlColumnIndex column) |
| The name of a result column, as the driver describes it. | |
| LIGHTWEIGHT_API std::expected< SqlResultColumnType, SqlErrorInfo > | Lightweight::Driver::Odbc::ColumnType (Statement const &stmt, SqlColumnIndex column) |
| The SQL data type of a result column, as the driver describes it. | |
| LIGHTWEIGHT_API SqlResultColumnType | Lightweight::Driver::Odbc::ToResultColumnType (std::int16_t sqlType) noexcept |
Maps an ODBC SQL_* type code onto the driver-neutral SqlResultColumnType. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::SetQueryTimeout (Statement &stmt, std::chrono::seconds timeout) noexcept |
| Sets the query timeout of the statement. | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::QueryTimeout (Statement const &stmt, std::chrono::seconds &timeout) noexcept |
| Reports the query timeout of the statement. | |
| SQLRETURN | Lightweight::Driver::Odbc::DescribeResultColumnSqlType (SQLHSTMT stmt, SqlColumnIndex column, SQLSMALLINT *columnType) noexcept |
| std::optional< SQLSMALLINT > | Lightweight::Driver::Odbc::DescribeResultColumnSqlType (SQLHSTMT stmt, SqlColumnIndex column) noexcept |
| std::optional< std::int16_t > | Lightweight::Driver::Odbc::DescribeResultColumnSqlType (Statement const &stmt, SqlColumnIndex column) noexcept |
| ParameterArrayLayout | Lightweight::Driver::Odbc::CurrentParameterArrayLayout (Statement const &stmt, std::size_t valueSize, std::size_t columnWiseRowCount) noexcept |
| detail::OdbcCallOutcome | Lightweight::Driver::Odbc::CheckResult (Statement const &stmt, SqlResult result, std::source_location sourceLocation) |
The non-throwing, fault-seam-aware verdict on result (see detail::CheckOdbcCall()). | |
| SqlResultColumnType | Lightweight::Driver::Odbc::CatalogColumnType (Statement const &stmt, int dataType) noexcept |
The type a DATA_TYPE code of a catalog result set (SQLColumns, ...) stands for: the code mapped as ToResultColumnType maps a code SQLDescribeCol reports. | |
| LIGHTWEIGHT_API std::size_t | Lightweight::Driver::Odbc::DeclaredBoundColumnSize (Statement const &stmt, SqlColumnIndex column, SqlOutputColumnLength length) noexcept |
The declared length of output column column as a bound buffer size: between detail::DefaultBoundColumnSize and detail::MaxDeclaredBoundColumnSize, and detail::DefaultBoundColumnSize for a length the driver does not report or one above the maximum (a MAX or LONG column). One SQLColAttribute call. | |
| SqlResult | Lightweight::Driver::Odbc::DescribeColumn (Statement const &stmt, SqlColumnIndex column, SqlColumnDescription &description) noexcept |
Describes a result column (SQLDescribeCol): the Lightweight::Driver::SqlDriver concept's form, with the type mapped by ToResultColumnType. | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::RegisterAnsiOnly (Statement const &stmt, Connection const &connection) noexcept |
Records stmt as belonging to a connection whose driver takes text only through the ANSI entry points, so that its diagnostics are read through those as well. | |
| LIGHTWEIGHT_API void | Lightweight::Driver::Odbc::ResetRowArrayAttributes (Statement &stmt) noexcept |
| Restores single-row, column-bound fetching and unbinds the row status and rows-fetched pointers. The results are not reported. Part of the Lightweight::Driver::SqlDriver concept. | |
| template<typename Check > | |
| void | Lightweight::Driver::Odbc::SetColumnWiseParameterArray (Statement &stmt, std::size_t rowCount, void *bindOffset, Check const &check) |
Sets up column-wise parameter-array binding of rowCount parameter sets. | |
| template<typename Check > | |
| void | Lightweight::Driver::Odbc::SetRowWiseParameterArray (Statement &stmt, std::size_t rowCount, std::size_t rowStride, ProcessedCount *processedCount, Check const &check) |
Sets up row-wise parameter-array binding of rowCount parameter sets, rowStride bytes apart. | |
| template<typename Check > | |
| void | Lightweight::Driver::Odbc::SetParameterStatusArrays (Statement &stmt, RowStatus *paramStatus, ProcessedCount *processedCount, Check const &check) |
| Binds the arrays the driver reports per-parameter-set status and the processed count into. | |
| template<typename Check > | |
| void | Lightweight::Driver::Odbc::SetRowArray (Statement &stmt, std::size_t rowBindType, std::size_t arrayDepth, RowStatus *rowStatus, ProcessedCount *rowsFetched, Check const &check) |
Sets up row-array fetching of up to arrayDepth rows per FetchNextBlock. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::BindColumn (Statement &stmt, SqlColumnIndex column, std::int16_t cType, void *buffer, SqlIndicator bufferLength, SqlIndicator *indicators) noexcept |
Binds a result column to a buffer (SQLBindCol). | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::BindTextColumn (Statement &stmt, SqlColumnIndex column, char *buffer, SqlIndicator bufferLength, SqlIndicator *indicators) noexcept |
Binds a result column to a narrow character buffer (SQL_C_CHAR). | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::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). lengthIndicator serves as both the buffer length and the length indicator. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Odbc::FetchNextBlock (Statement &stmt) noexcept |
Fetches the next block of rows into the row-array bound columns (SQLFetchScroll, SQL_FETCH_NEXT). | |
| LIGHTWEIGHT_API SqlResult | Lightweight::Driver::Odbc::DescribeColumn (Statement const &stmt, SqlColumnIndex column, ColumnDescription &description) noexcept |
Describes a result column (SQLDescribeCol). | |
| LIGHTWEIGHT_API std::vector< std::int16_t > | Lightweight::Driver::Odbc::DescribeParameterTypes (Statement const &stmt, std::size_t count) |
Describes the declared SQL type of each of the first count parameters (SQLDescribeParam). | |
| LIGHTWEIGHT_API std::int16_t | Lightweight::Driver::Odbc::BoundParameterCount (Statement const &stmt) noexcept |
| The number of parameters currently bound on the statement, read from its application parameter descriptor. | |
Variables | |
| constexpr RowStatus | Lightweight::Driver::Odbc::ParamStatusUnused = SQL_PARAM_UNUSED |
The parameter status of a parameter set the driver did not process (SQL_PARAM_UNUSED). | |
| constexpr RowStatus | Lightweight::Driver::Odbc::ParamStatusError = SQL_PARAM_ERROR |
The parameter status of a parameter set that failed (SQL_PARAM_ERROR). | |
| constexpr RowStatus | Lightweight::Driver::Odbc::RowStatusError = SQL_ROW_ERROR |
The row status of a fetched row the driver could not convert (SQL_ROW_ERROR). | |
| constexpr std::int16_t | Lightweight::Driver::Odbc::UnknownParameterType = SQL_UNKNOWN_TYPE |
The declared SQL type DescribeParameterTypes reports for a parameter it could not describe. | |
The statement operations of the ODBC driver: everything SqlStatement and its cursors ask an ODBC statement handle to do. The first group is the statement half of the Lightweight::Driver::SqlDriver concept; the second group is ODBC-only (parameter and row arrays, column binding, describing), used by code paths that exist only for the ODBC driver.
Every function is a thin wrapper: the same ODBC calls with the same arguments in the same order as the code it was moved from, and the return code handed back as Lightweight::SqlResult so that the caller decides how to check it (and keeps the fault seam of RequireSuccess at its call site).
Definition in file Statement.hpp.
| using Lightweight::Driver::Odbc::ProcessedCount = typedef SQLULEN |
The count a driver writes back through a parameter-array or row-array attribute pointer (SQL_ATTR_PARAMS_PROCESSED_PTR, SQL_ATTR_ROWS_FETCHED_PTR).
Definition at line 44 of file Statement.hpp.
| using Lightweight::Driver::Odbc::RowStatus = typedef SQLUSMALLINT |
One element of a parameter-status or row-status array (SQL_ATTR_PARAM_STATUS_PTR, SQL_ATTR_ROW_STATUS_PTR).
Definition at line 48 of file Statement.hpp.
|
noexcept |
Allocates a statement handle on connection.
| connection | The connection to allocate on. |
| stmt | Receives the handle; it is written whatever the result (null on failure). |
SQLAllocHandle. References Lightweight::Driver::Allocate().
|
noexcept |
Frees the statement handle and leaves stmt empty.
| stmt | The statement to free; may be empty. |
References Lightweight::Driver::Free().
|
noexcept |
Gives up a statement handle whose connection session ended, and leaves stmt empty.
The driver freed the handle with the session (Close(), a re-connect), so it is not freed again: only the record that its diagnostics are read through the ANSI entry points is dropped.
| stmt | The statement; may be empty. |
References Lightweight::Driver::Abandon().
| LIGHTWEIGHT_API SqlResult Lightweight::Driver::Odbc::Prepare | ( | Statement & | stmt, |
| std::string_view | query, | ||
| bool | wideQueryText | ||
| ) |
Prepares query on the statement.
| stmt | The statement. |
| query | The SQL text, UTF-8. |
| wideQueryText | Whether to hand the text to the W entry point (as UTF-16); otherwise the ANSI entry point gets the UTF-8 bytes unchanged (see SqlConnection::AcceptsWideQueryText()). |
SQLPrepare.
|
inlinenoexcept |
Executes the prepared statement with the currently bound parameters.
| stmt | The statement. |
SQLExecute; SqlResult::NoData for a searched UPDATE/DELETE that matched no rows. Definition at line 123 of file Statement.hpp.
| LIGHTWEIGHT_API SqlResult Lightweight::Driver::Odbc::ExecuteDirect | ( | Statement & | stmt, |
| std::string_view | query, | ||
| bool | wideQueryText | ||
| ) |
Executes query directly, without preparing it.
| stmt | The statement. |
| query | The SQL text, UTF-8. |
| wideQueryText | As for Prepare. |
SQLExecDirect.
|
inlinenoexcept |
Fetches the next row of the result set into the bound columns.
| stmt | The statement. |
SQLFetch; SqlResult::NoData past the last row. Definition at line 138 of file Statement.hpp.
|
inlinenoexcept |
Advances to the next pending result set.
| stmt | The statement. |
SQLMoreResults; SqlResult::NoData when none is pending. Definition at line 146 of file Statement.hpp.
References Lightweight::Driver::MoreResults().
|
noexcept |
Closes the cursor of a result set that was read to its end (SQLCloseCursor). Pending result sets are left alone; the result is not reported.
| stmt | The statement. |
References Lightweight::Driver::CloseCursor().
|
noexcept |
Closes any open cursor and discards its pending rows (SQLFreeStmt with SQL_CLOSE), so the handle can run another query. Pending result sets are left alone; the result is not reported.
| stmt | The statement. |
DiscardResults covers it there. References Lightweight::Driver::Odbc::ReleaseCursor().
Referenced by Lightweight::Driver::Odbc::DiscardResults(), and Lightweight::Driver::Odbc::ReleaseCursor().
|
inlinenoexcept |
Drains every pending result set (SQLMoreResults until SQL_NO_DATA or an error), then closes the cursor (ReleaseCursor), so the handle can run another query. An error met while draining ends the drain and is not reported.
| stmt | The statement. |
Definition at line 166 of file Statement.hpp.
References Lightweight::Driver::DiscardResults(), Lightweight::Driver::MoreResults(), and Lightweight::Driver::Odbc::ReleaseCursor().
|
noexcept |
Unbinds every bound result column (SQLFreeStmt with SQL_UNBIND).
| stmt | The statement. |
SQLFreeStmt. References Lightweight::Driver::UnbindColumns().
|
noexcept |
Drops every parameter binding (SQLFreeStmt with SQL_RESET_PARAMS).
| stmt | The statement. |
SQLFreeStmt. References Lightweight::Driver::ResetParameters().
|
noexcept |
Restores single-row, column-bound parameter binding (the ODBC default) and unbinds the parameter status and processed-count pointers. The results are not reported: resetting to defaults on a live handle does not meaningfully fail.
| stmt | The statement. |
References Lightweight::Driver::ResetParameterArrays().
|
noexcept |
Reports the number of columns of the current result set.
| stmt | The statement. |
| count | Receives the column count (0 for a statement that produced no result set). |
SQLNumResultCols. References Lightweight::Driver::NumResultColumns().
|
noexcept |
Reports the number of parameters of the prepared statement.
| stmt | The statement. |
| count | Receives the parameter count. |
SQLNumParams. References Lightweight::Driver::NumParameters().
|
noexcept |
Reports the number of rows the last executed statement affected.
| stmt | The statement. |
| count | Receives the row count; -1 when the driver cannot tell. |
SQLRowCount. References Lightweight::Driver::NumRowsAffected().
| LIGHTWEIGHT_API std::expected< std::string, SqlErrorInfo > Lightweight::Driver::Odbc::ColumnName | ( | Statement const & | stmt, |
| SqlColumnIndex | column | ||
| ) |
The name of a result column, as the driver describes it.
| stmt | The statement, with a result set. |
| column | The 1-based result column. |
References Lightweight::Driver::Odbc::ColumnName().
Referenced by Lightweight::Driver::Odbc::ColumnName().
| LIGHTWEIGHT_API std::expected< SqlResultColumnType, SqlErrorInfo > Lightweight::Driver::Odbc::ColumnType | ( | Statement const & | stmt, |
| SqlColumnIndex | column | ||
| ) |
The SQL data type of a result column, as the driver describes it.
| stmt | The statement, with a result set. |
| column | The 1-based result column. |
SqlResultColumnType::Unknown for a type without an enumerator, or the statement's diagnostics if the column cannot be described. References Lightweight::Driver::ColumnType().
|
noexcept |
Maps an ODBC SQL_* type code onto the driver-neutral SqlResultColumnType.
| sqlType | The SQL_* type code, as DescribeColumn reports it. |
SqlResultColumnType::Unknown for a code without an enumerator. References Lightweight::Driver::Odbc::ToResultColumnType().
Referenced by Lightweight::Driver::Odbc::CatalogColumnType(), Lightweight::Driver::Odbc::DescribeColumn(), and Lightweight::Driver::Odbc::ToResultColumnType().
|
noexcept |
Sets the query timeout of the statement.
| stmt | The statement. |
| timeout | The timeout; zero means none. |
SQLSetStmtAttr. References Lightweight::Driver::SetQueryTimeout().
|
noexcept |
Reports the query timeout of the statement.
| stmt | The statement. |
| timeout | Receives the timeout; zero means none. |
SQLGetStmtAttr. References Lightweight::Driver::QueryTimeout().
|
inlinenoexcept |
Asks the driver for the concise SQL type of result column column with SQLDescribeColW.
SQLDescribeCol reports the concise SQL type code (e.g. SQL_TYPE_DATE, SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP). It is asked rather than SQLColAttribute(SQL_DESC_CONCISE_TYPE), which the SQLite driver answers with SQL_WCHAR for a BLOB column. The W variant keeps the ODBC call surface on the Unicode-app path the rest of the library uses. The column name is not needed, but a real buffer with its true length is passed: psqlODBC under unixODBC fails a null or zero-length name buffer with HY001 ("Could not allocate memory for column name"). On the stack, and a name longer than it is only truncated (01004, a success).
| stmt | The statement handle. |
| column | The 1-based column index. |
| columnType | Receives the SQL type. |
Definition at line 256 of file Statement.hpp.
References Lightweight::Driver::DescribeResultColumnSqlType().
|
inlinenoexcept |
Asks the driver for the concise SQL type of result column column (see the overload above).
| stmt | The statement handle. |
| column | The 1-based column index. |
std::nullopt when the driver cannot describe the column. Definition at line 278 of file Statement.hpp.
References Lightweight::Driver::DescribeResultColumnSqlType().
|
inlinenoexcept |
Asks the driver for the concise SQL type of result column column (see the overloads above): the Lightweight::Driver::SqlDriver concept's form, which SqlStatement caches for the leaf binders.
| stmt | The statement. |
| column | The 1-based column index. |
std::nullopt when the driver cannot describe the column. Definition at line 291 of file Statement.hpp.
References Lightweight::Driver::DescribeResultColumnSqlType().
|
inlinenoexcept |
Reads the layout of the parameter array the statement is bound with.
| stmt | The statement whose parameters are being bound. |
| valueSize | The size of one value, which is the stride of a column-wise array. |
| columnWiseRowCount | The row count of a column-wise (or single-row) binding. |
Definition at line 312 of file Statement.hpp.
References Lightweight::Driver::Odbc::CurrentParameterArrayLayout(), and Lightweight::Driver::Odbc::ParameterArrayLayout::rowStride.
Referenced by Lightweight::Driver::Odbc::CurrentParameterArrayLayout().
|
inline |
The non-throwing, fault-seam-aware verdict on result (see detail::CheckOdbcCall()).
| stmt | The statement result came from. |
| result | The result to check. |
| sourceLocation | Where the check originated; forwarded to the fault source. |
Definition at line 335 of file Statement.hpp.
References Lightweight::Driver::CheckResult(), and Lightweight::Driver::Odbc::Statement::handle.
|
inlinenoexcept |
The type a DATA_TYPE code of a catalog result set (SQLColumns, ...) stands for: the code mapped as ToResultColumnType maps a code SQLDescribeCol reports.
| stmt | The statement holding the catalog result set (unused: the codes are ODBC's). |
| dataType | The SQL_* code, as read from the result set. |
SqlResultColumnType::Unknown for a code without an enumerator, or outside the range of an SQLSMALLINT. Definition at line 348 of file Statement.hpp.
References Lightweight::Driver::CatalogColumnType(), and Lightweight::Driver::Odbc::ToResultColumnType().
|
noexcept |
The declared length of output column column as a bound buffer size: between detail::DefaultBoundColumnSize and detail::MaxDeclaredBoundColumnSize, and detail::DefaultBoundColumnSize for a length the driver does not report or one above the maximum (a MAX or LONG column). One SQLColAttribute call.
| stmt | The statement holding the result set. |
| column | The 1-based column index. |
| length | Which declared length to ask for. |
References Lightweight::Driver::DeclaredBoundColumnSize(), and Lightweight::Driver::DescribeColumn().
|
inlinenoexcept |
Describes a result column (SQLDescribeCol): the Lightweight::Driver::SqlDriver concept's form, with the type mapped by ToResultColumnType.
| stmt | The statement, with a result set. |
| column | The 1-based result column. |
| description | Receives the description. |
SQLDescribeCol. Definition at line 533 of file Statement.hpp.
References Lightweight::Driver::DescribeColumn(), Lightweight::Driver::Odbc::ToResultColumnType(), and Lightweight::Driver::SqlColumnDescription::type.
|
noexcept |
Records stmt as belonging to a connection whose driver takes text only through the ANSI entry points, so that its diagnostics are read through those as well.
| stmt | The freshly allocated statement. |
| connection | The connection it was allocated on. |
References Lightweight::Driver::RegisterAnsiOnly().
|
noexcept |
Restores single-row, column-bound fetching and unbinds the row status and rows-fetched pointers. The results are not reported. Part of the Lightweight::Driver::SqlDriver concept.
| stmt | The statement. |
References Lightweight::Driver::ResetRowArrayAttributes().
| void Lightweight::Driver::Odbc::SetColumnWiseParameterArray | ( | Statement & | stmt, |
| std::size_t | rowCount, | ||
| void * | bindOffset, | ||
| Check const & | check | ||
| ) |
Sets up column-wise parameter-array binding of rowCount parameter sets.
| stmt | The statement. |
| rowCount | The number of parameter sets. |
| bindOffset | The SQL_ATTR_PARAM_BIND_OFFSET_PTR value. |
| check | Called with each attribute's result, right after setting it; throwing stops the setup. |
Definition at line 399 of file Statement.hpp.
References Lightweight::Driver::Odbc::Statement::handle, and Lightweight::Driver::Odbc::SetColumnWiseParameterArray().
Referenced by Lightweight::Driver::Odbc::SetColumnWiseParameterArray().
| void Lightweight::Driver::Odbc::SetRowWiseParameterArray | ( | Statement & | stmt, |
| std::size_t | rowCount, | ||
| std::size_t | rowStride, | ||
| ProcessedCount * | processedCount, | ||
| Check const & | check | ||
| ) |
Sets up row-wise parameter-array binding of rowCount parameter sets, rowStride bytes apart.
| stmt | The statement. |
| rowCount | The number of parameter sets. |
| rowStride | The byte distance between two consecutive parameter sets. |
| processedCount | Receives the number of parameter sets the driver processed. |
| check | Called with each attribute's result, right after setting it; throwing stops the setup. |
Definition at line 414 of file Statement.hpp.
References Lightweight::Driver::Odbc::Statement::handle, and Lightweight::Driver::Odbc::SetRowWiseParameterArray().
Referenced by Lightweight::Driver::Odbc::SetRowWiseParameterArray().
| void Lightweight::Driver::Odbc::SetParameterStatusArrays | ( | Statement & | stmt, |
| RowStatus * | paramStatus, | ||
| ProcessedCount * | processedCount, | ||
| Check const & | check | ||
| ) |
Binds the arrays the driver reports per-parameter-set status and the processed count into.
| stmt | The statement. |
| paramStatus | Receives one status per parameter set. |
| processedCount | Receives the number of parameter sets the driver processed. |
| check | Called with each attribute's result, right after setting it; throwing stops the setup. |
Definition at line 430 of file Statement.hpp.
References Lightweight::Driver::Odbc::Statement::handle, and Lightweight::Driver::Odbc::SetParameterStatusArrays().
Referenced by Lightweight::Driver::Odbc::SetParameterStatusArrays().
| void Lightweight::Driver::Odbc::SetRowArray | ( | Statement & | stmt, |
| std::size_t | rowBindType, | ||
| std::size_t | arrayDepth, | ||
| RowStatus * | rowStatus, | ||
| ProcessedCount * | rowsFetched, | ||
| Check const & | check | ||
| ) |
Sets up row-array fetching of up to arrayDepth rows per FetchNextBlock.
| stmt | The statement. |
| rowBindType | The SQL_ATTR_ROW_BIND_TYPE: 0 (SQL_BIND_BY_COLUMN) for column-wise binding, otherwise the byte distance between two consecutive bound rows. |
| arrayDepth | The number of rows per block. |
| rowStatus | Receives one status per fetched row. |
| rowsFetched | Receives the number of rows of the last fetched block. |
| check | Called with each attribute's result, right after setting it; throwing stops the setup. |
Definition at line 445 of file Statement.hpp.
References Lightweight::Driver::Odbc::Statement::handle, and Lightweight::Driver::Odbc::SetRowArray().
Referenced by Lightweight::Driver::Odbc::SetRowArray().
|
inlinenoexcept |
Binds a result column to a buffer (SQLBindCol).
| stmt | The statement. |
| column | The 1-based result column. |
| cType | The SQL_C_* type to bind as. |
| buffer | The (first row's) value buffer. |
| bufferLength | The byte length of one row's value buffer; ignored for fixed-size C types. |
| indicators | The (first row's) length indicator. |
SQLBindCol. Definition at line 466 of file Statement.hpp.
References Lightweight::Driver::Odbc::BindColumn().
Referenced by Lightweight::Driver::Odbc::BindColumn(), and Lightweight::Driver::Odbc::BindTextColumn().
|
inlinenoexcept |
Binds a result column to a narrow character buffer (SQL_C_CHAR).
| stmt | The statement. |
| column | The 1-based result column. |
| buffer | The (first row's) character buffer. |
| bufferLength | The byte length of one row's buffer, including the NUL terminator. |
| indicators | The (first row's) length indicator. |
SQLBindCol. Definition at line 483 of file Statement.hpp.
References Lightweight::Driver::Odbc::BindColumn(), and Lightweight::Driver::Odbc::BindTextColumn().
Referenced by Lightweight::Driver::Odbc::BindTextColumn().
|
inlinenoexcept |
Binds UTF-16 text as an input parameter of SQL type SQL_WVARCHAR (SQLBindParameter with SQL_C_WCHAR). lengthIndicator serves as both the buffer length and the length indicator.
| stmt | The statement. |
| parameter | The 1-based parameter. |
| text | The text; must stay alive until the statement is executed. |
| columnSize | The declared column size of the parameter. |
| lengthIndicator | The byte length of text; must stay alive until the statement is executed. Shared code passes a length >= 0 only: the other drivers do not give ODBC's special lengths a meaning (the native SQLite3 driver fails a negative one with HY090). |
SQLBindParameter. sys.*) through it, without naming the driver. Definition at line 501 of file Statement.hpp.
References Lightweight::Driver::Odbc::BindUtf16TextParameter().
Referenced by Lightweight::Driver::Odbc::BindUtf16TextParameter().
|
inlinenoexcept |
Fetches the next block of rows into the row-array bound columns (SQLFetchScroll, SQL_FETCH_NEXT).
| stmt | The statement. |
SQLFetchScroll; SqlResult::NoData past the last row. Definition at line 519 of file Statement.hpp.
References Lightweight::Driver::Odbc::FetchNextBlock().
Referenced by Lightweight::Driver::Odbc::FetchNextBlock().
|
noexcept |
Describes a result column (SQLDescribeCol).
| stmt | The statement, with a result set. |
| column | The 1-based result column. |
| description | Receives the description. |
SQLDescribeCol. References Lightweight::Driver::DescribeColumn().
| LIGHTWEIGHT_API std::vector< std::int16_t > Lightweight::Driver::Odbc::DescribeParameterTypes | ( | Statement const & | stmt, |
| std::size_t | count | ||
| ) |
Describes the declared SQL type of each of the first count parameters (SQLDescribeParam).
| stmt | The prepared statement. |
| count | The number of parameters to describe. |
SQL_* type per parameter, UnknownParameterType where the driver could not say. References Lightweight::Driver::DescribeParameterTypes().
|
noexcept |
The number of parameters currently bound on the statement, read from its application parameter descriptor.
| stmt | The statement. |
References Lightweight::Driver::BoundParameterCount().
|
inlineconstexpr |
The parameter status of a parameter set the driver did not process (SQL_PARAM_UNUSED).
Definition at line 51 of file Statement.hpp.
|
inlineconstexpr |
The parameter status of a parameter set that failed (SQL_PARAM_ERROR).
Definition at line 54 of file Statement.hpp.
|
inlineconstexpr |
The row status of a fetched row the driver could not convert (SQL_ROW_ERROR).
Definition at line 57 of file Statement.hpp.
|
inlineconstexpr |
The declared SQL type DescribeParameterTypes reports for a parameter it could not describe.
Definition at line 60 of file Statement.hpp.