|
Lightweight 0.20261105.1
|
#include "../Api.hpp"#include "../SqlBindingTypes.hpp"#include "../SqlConnectInfo.hpp"#include "../SqlError.hpp"#include "../SqlServerType.hpp"#include "Concept.hpp"#include "DriverSet.hpp"#include <chrono>#include <concepts>#include <cstddef>#include <cstdint>#include <expected>#include <format>#include <functional>#include <optional>#include <source_location>#include <string>#include <string_view>#include <tuple>#include <type_traits>#include <utility>#include <vector>Go to the source code of this file.
Functions | |
| constexpr bool | Lightweight::Driver::IsEnabled (SqlDriverId id) noexcept |
Whether the library was built with driver id (a fold over the enabled drivers). | |
| constexpr std::string_view | Lightweight::Driver::NameOf (SqlDriverId id) noexcept |
| The display name of an enabled driver, as error messages show it. | |
| constexpr bool | Lightweight::Driver::SupportsParameterArrays (SqlDriverId id) noexcept |
| Whether an enabled driver executes parameter arrays natively (one call per batch). | |
| constexpr bool | Lightweight::Driver::SupportsRowArrayFetch (SqlDriverId id) noexcept |
| Whether an enabled driver fetches blocks of rows into array-bound columns natively. | |
| constexpr bool | Lightweight::Driver::StatementsDieWithConnection (SqlDriverId id) noexcept |
| Whether closing a connection of an enabled driver destroys its statement handles, so that they must not be freed afterwards. | |
| constexpr bool | Lightweight::Driver::TranscodesNarrowText (SqlDriverId id) noexcept |
| Whether an enabled driver may pass narrow text through a client codepage, so that whether narrow text round-trips byte-exact depends on the backend. | |
| constexpr bool | Lightweight::Driver::HasCatalogFunctions (SqlDriverId id) noexcept |
Whether an enabled driver reads a database's catalog with catalog functions of its own (ODBC's SQLTables, SQLColumns, ...); false when SqlSchema reads it with the SQL of SqlQueryFormatter::CatalogQueries(). | |
| SqlResult | Lightweight::Driver::AllocateStatement (ConnectionHandle const &connection, StatementHandle &statement) noexcept |
Allocates a statement of the connection's driver and binds statement to that driver. | |
| void | Lightweight::Driver::Free (StatementHandle &statement) noexcept |
Frees the statement's driver handle and leaves statement empty, bound to the same driver. | |
| void | Lightweight::Driver::Abandon (StatementHandle &statement) noexcept |
Gives up the statement's driver handle after its connection session ended, and leaves statement empty, bound to the same driver: what died with the session is not touched again, what the driver still holds for the statement is released (see each driver's Abandon). | |
| StatementHandle | Lightweight::Driver::Alias (StatementHandle const &statement) noexcept |
A second handle naming the same driver statement as statement (its driver struct copied, see SqlDriverHandleStruct): it owns nothing more, so only one of the two may free it. | |
| bool | Lightweight::Driver::SameStatement (StatementHandle const &first, StatementHandle const &second) noexcept |
| Tells whether two handles name the same driver statement. | |
| SqlResult | Lightweight::Driver::Prepare (StatementHandle &statement, std::string_view query, bool wideQueryText) |
Prepares query on the statement. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Execute (StatementHandle &statement) noexcept |
| Executes the prepared statement with the currently bound parameters. | |
| SqlResult | Lightweight::Driver::ExecuteDirect (StatementHandle &statement, std::string_view query, bool wideQueryText) |
Executes query directly, without preparing it. | |
| LIGHTWEIGHT_FORCE_INLINE SqlResult | Lightweight::Driver::Fetch (StatementHandle &statement) noexcept |
| Fetches the next row of the result set into the bound columns. | |
| SqlResult | Lightweight::Driver::MoreResults (StatementHandle &statement) noexcept |
| Advances to the next pending result set. | |
| void | Lightweight::Driver::CloseCursor (StatementHandle &statement) noexcept |
| Closes the cursor of a result set that was read to its end. Pending result sets are left alone. | |
| void | Lightweight::Driver::DiscardResults (StatementHandle &statement) noexcept |
| Drains every pending result set and closes the cursor, so the handle can run another query. An error met while draining is not reported. | |
| SqlResult | Lightweight::Driver::UnbindColumns (StatementHandle &statement) noexcept |
| Unbinds every bound result column. | |
| SqlResult | Lightweight::Driver::ResetParameters (StatementHandle &statement) noexcept |
| Drops every parameter binding. | |
| void | Lightweight::Driver::ResetParameterArrays (StatementHandle &statement) noexcept |
| Restores single-row parameter binding after a parameter-array execution. Not reported. | |
| SqlResult | Lightweight::Driver::NumResultColumns (StatementHandle const &statement, std::int16_t &count) noexcept |
| Reports the number of columns of the current result set. | |
| SqlResult | Lightweight::Driver::NumParameters (StatementHandle const &statement, std::int16_t &count) noexcept |
| Reports the number of parameters of the prepared statement. | |
| SqlResult | Lightweight::Driver::NumRowsAffected (StatementHandle const &statement, std::ptrdiff_t &count) noexcept |
| Reports the number of rows the last executed statement affected. | |
| std::expected< SqlResultColumnType, SqlErrorInfo > | Lightweight::Driver::ColumnType (StatementHandle const &statement, SqlColumnIndex column) |
| The SQL data type of a result column, as the driver describes it. | |
| SqlResult | Lightweight::Driver::SetQueryTimeout (StatementHandle &statement, std::chrono::seconds timeout) noexcept |
| Sets the query timeout of the statement. | |
| SqlResult | Lightweight::Driver::QueryTimeout (StatementHandle const &statement, std::chrono::seconds &timeout) noexcept |
| Reports the query timeout of the statement. | |
| SqlErrorInfo | Lightweight::Driver::Diagnose (StatementHandle const &statement) |
| Reads the statement's diagnostics: the first record its last failed call left. | |
| void | Lightweight::Driver::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 expected to recover from, SqlException otherwise (see ClassifyResult). | |
| CallOutcome | Lightweight::Driver::CheckResult (StatementHandle const &statement, SqlResult result, std::source_location location) |
The non-throwing, fault-seam-aware verdict on result. | |
| SqlResult | Lightweight::Driver::OpenCatalog (StatementHandle const &statement, SqlCatalogRequest const &request) |
Opens the catalog result set request names on statement, in the layout the ODBC specification gives that catalog function. | |
| SqlResultColumnType | Lightweight::Driver::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 | Lightweight::Driver::DescribeColumn (StatementHandle const &statement, SqlColumnIndex column, SqlColumnDescription &description) |
| Describes a result column: its type and its size. | |
| std::optional< std::int16_t > | Lightweight::Driver::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 SqlDataBinderCallback::DescribeResultColumnType). | |
| std::size_t | Lightweight::Driver::DeclaredBoundColumnSize (StatementHandle const &statement, SqlColumnIndex column, SqlOutputColumnLength length) noexcept |
The declared length of a result column as a bound buffer size (see SqlDataBinderCallback::MinimumOutputColumnSize). | |
| void | Lightweight::Driver::ResetRowArrayAttributes (StatementHandle &statement) noexcept |
| Restores single-row fetching after a row-array fetch. Not reported; nothing for a driver without row arrays. | |
| void | Lightweight::Driver::Allocate (ConnectionHandle &connection) noexcept |
| Allocates the driver's connection resources, unless the connection already holds them. | |
| std::expected< void, SqlErrorInfo > | Lightweight::Driver::Close (ConnectionHandle &connection, CloseDiagnostic diagnostic) noexcept |
Closes the connection: disconnects it, frees its driver resources and leaves connection empty, bound to the same driver. Not reported. | |
| SqlResult | Lightweight::Driver::Disconnect (ConnectionHandle &connection) noexcept |
| Ends the connection's session, keeping its driver resources for the next connect. | |
| bool | Lightweight::Driver::IsAllocated (ConnectionHandle const &connection) noexcept |
Tells whether connection holds a driver connection (connected or not). | |
| bool | Lightweight::Driver::IsAlive (ConnectionHandle const &connection) noexcept |
| Tells whether the driver still considers the connection alive. | |
| SqlErrorInfo | Lightweight::Driver::LastError (ConnectionHandle const &connection) |
| Reads the connection's diagnostics: the first record its last failed call left. | |
| CallOutcome | Lightweight::Driver::CheckResult (ConnectionHandle const &connection, SqlResult result, std::source_location location) |
The non-throwing, fault-seam-aware verdict on result of a call on connection. | |
| std::string | Lightweight::Driver::ServerName (ConnectionHandle const &connection) |
| The name of the DBMS the connection is connected to. | |
| std::string | Lightweight::Driver::ServerVersion (ConnectionHandle const &connection) |
| The version of the DBMS the connection is connected to. | |
| std::string | Lightweight::Driver::DriverName (ConnectionHandle const &connection) |
| The name of the driver (library) the connection runs on. | |
| std::string | Lightweight::Driver::DatabaseName (ConnectionHandle const &connection) |
| The name of the database in use. | |
| std::string | Lightweight::Driver::UserName (ConnectionHandle const &connection) |
| The name of the user the connection is logged in as. | |
| bool | Lightweight::Driver::TransactionActive (ConnectionHandle const &connection) noexcept |
| Tells whether a transaction is open, i.e. autocommit is off. | |
| bool | Lightweight::Driver::TransactionsAllowed (ConnectionHandle const &connection) noexcept |
| Tells whether the data source supports transactions. | |
| SqlResult | Lightweight::Driver::SetAutoCommit (ConnectionHandle &connection, bool enabled) noexcept |
| Switches autocommit mode on or off. | |
| SqlResult | Lightweight::Driver::Commit (ConnectionHandle &connection) noexcept |
| Commits the open transaction. | |
| SqlResult | Lightweight::Driver::Rollback (ConnectionHandle &connection) noexcept |
| Rolls back the open transaction. | |
| SqlResult | Lightweight::Driver::SetIsolation (ConnectionHandle &connection, SqlIsolationMode mode) noexcept |
| Sets the transaction isolation level of the connection. | |
| bool | Lightweight::Driver::RollbackOpenTransaction (ConnectionHandle &connection) noexcept |
| Rolls back the open transaction and switches autocommit back on. | |
| std::expected< std::string, SqlErrorInfo > | Lightweight::Driver::SearchPatternEscape (ConnectionHandle const &connection) |
The string the driver escapes the wildcards of a catalog search pattern with (see OpenCatalog). | |
| template<typename Info > | |
| bool | Lightweight::Driver::RebindsDriverFor (ConnectionHandle const &handle) noexcept |
Tells whether connecting from Info binds handle to another driver than the one it is bound to. | |
| template<typename Info > | |
| void | Lightweight::Driver::BindDriverFor (ConnectionHandle &handle) noexcept |
Binds handle to the enabled driver D for which Connect(D::Connection&, Info const&, std::source_location) is well-formed (found by argument-dependent lookup), closing what the handle held if that was another driver's. No such driver: no change. | |
| template<typename Info > | |
| std::expected< void, SqlErrorInfo > | Lightweight::Driver::Connect (ConnectionHandle &handle, Info const &info, std::source_location location) |
Connects handle from info through the enabled driver that connects from it. | |
| bool | Lightweight::Driver::AcceptsWideQueryText (ConnectionHandle const &connection) noexcept |
| Tells whether the connection's driver receives wide (UTF-16) query text unchanged. | |
| bool | Lightweight::Driver::ReadsBoundColumnsAgain (ConnectionHandle const &connection) noexcept |
Tells whether the connection's driver can read a bound output column again, so that a bound value longer than its buffer is read in full (see SqlConnection::ReadsBoundColumnsAgain). | |
| ::Lightweight::detail::NarrowTextBinding | Lightweight::Driver::NarrowTextBinding (ConnectionHandle const &connection, SqlServerType serverType, SqlConnectInfo const &connectInfo) |
Tells how the narrow string binders exchange text with the connection's driver (see SqlConnection::NarrowTextBindingMode). | |
| std::string | Lightweight::Driver::DriverNameOf (ConnectionHandle const &connection, SqlConnectionString const &connectionString) |
Names the driver a connect from connectionString reaches, without connecting (see ServerTypeFromDriverName): the connection string's own DRIVER, else what the driver manager lists for its DSN. | |
| void | Lightweight::Driver::RegisterTextEntry (ConnectionHandle const &connection, bool acceptsWideQueryText) noexcept |
| Records whether the connection's driver takes text through its wide entry points, where the driver has such a choice; does nothing otherwise. | |
| void | Lightweight::Driver::RegisterAnsiOnly (StatementHandle const &statement, ConnectionHandle const &connection) noexcept |
Records statement as belonging to a connection whose driver takes text only through its ANSI entry points, where the driver has such a choice; does nothing otherwise. | |
| std::vector< std::int16_t > | Lightweight::Driver::DescribeParameterTypes (StatementHandle const &statement, std::size_t count) |
Describes the declared SQL type of each of the first count parameters. | |
| std::int16_t | Lightweight::Driver::BoundParameterCount (StatementHandle const &statement) noexcept |
| The number of parameters currently bound on the statement. | |
| template<typename Handle , typename F > requires detail::TaggedHandle<std::remove_cvref_t<Handle>> | |
| void | Lightweight::Driver::VisitIfSupported (Handle &&handle, F &&f) |
Calls f with the held struct when f is invocable with it; otherwise does nothing. | |
| template<typename Handle , typename F > requires detail::TaggedHandle<std::remove_cvref_t<Handle>> | |
| decltype(auto) | Lightweight::Driver::VisitRequired (Handle &&handle, std::string_view operation, F &&f) |
Calls f with the held struct when invocable; otherwise throws SqlException(NotSupportedByDriver(id, operation)). | |
Variables | |
| constexpr bool | Lightweight::Driver::RefusesUnsetDefaultConnectInfo = !IsEnabled(SqlDriverId::Odbc) |
Whether a connection opened from the default connect info refuses to connect while no default was set (see SqlConnection::SetDefaultConnectInfo): with SQLSTATE 08001 instead of opening what the unset default names. Holds in a build without the ODBC driver, whose unset default would be a SqliteConnectInfo naming a private temporary database. With ODBC the unset default is an empty connection string, which the driver manager refuses itself. | |
The driver-neutral face of the Lightweight::Driver::SqlDriver concept: one function per concept operation, taking the tagged Lightweight::Driver::StatementHandle / Lightweight::Driver::ConnectionHandle instead of a driver's handle struct, plus the optional operations only some drivers provide and the typed visits for code that exists for one driver only.
Each function visits the handle and calls the driver's function unqualified inside the visit, so that it is found by argument-dependent lookup on the driver's handle struct. A dispatch function itself never matches a driver struct (the handles' constructors are explicit), so a driver lacking a required operation is a compile error rather than a recursion into the dispatch function. The layer exists because inside SqlStatement / SqlConnection members argument-dependent lookup is suppressed by the same-named members.
Definition in file Dispatch.hpp.
|
constexprnoexcept |
Whether the library was built with driver id (a fold over the enabled drivers).
| id | The driver's id; every known driver has one, whether or not the build contains it. |
true when the driver is one of the enabled drivers. Definition at line 197 of file Dispatch.hpp.
|
constexprnoexcept |
The display name of an enabled driver, as error messages show it.
| id | The driver's id. |
Name (e.g. "ODBC"); "unknown" for an id no enabled driver has. Definition at line 212 of file Dispatch.hpp.
|
constexprnoexcept |
Whether an enabled driver executes parameter arrays natively (one call per batch).
| id | The driver's id. |
SupportsParameterArrays; false for an id no enabled driver has. Definition at line 220 of file Dispatch.hpp.
References Lightweight::Driver::SupportsParameterArrays().
Referenced by Lightweight::Driver::SupportsParameterArrays().
|
constexprnoexcept |
Whether an enabled driver fetches blocks of rows into array-bound columns natively.
| id | The driver's id. |
SupportsRowArrayFetch; false for an id no enabled driver has. Definition at line 229 of file Dispatch.hpp.
References Lightweight::Driver::SupportsRowArrayFetch().
Referenced by Lightweight::Driver::SupportsRowArrayFetch().
|
constexprnoexcept |
Whether closing a connection of an enabled driver destroys its statement handles, so that they must not be freed afterwards.
| id | The driver's id. |
StatementsDieWithConnection; false for an id no enabled driver has. Definition at line 239 of file Dispatch.hpp.
References Lightweight::Driver::StatementsDieWithConnection().
Referenced by Lightweight::Driver::StatementsDieWithConnection().
|
constexprnoexcept |
Whether an enabled driver may pass narrow text through a client codepage, so that whether narrow text round-trips byte-exact depends on the backend.
| id | The driver's id. |
TranscodesNarrowText; false for an id no enabled driver has. Definition at line 249 of file Dispatch.hpp.
References Lightweight::Driver::TranscodesNarrowText().
Referenced by Lightweight::Driver::TranscodesNarrowText().
|
constexprnoexcept |
Whether an enabled driver reads a database's catalog with catalog functions of its own (ODBC's SQLTables, SQLColumns, ...); false when SqlSchema reads it with the SQL of SqlQueryFormatter::CatalogQueries().
| id | The driver's id. |
HasCatalogFunctions; false for an id no enabled driver has. Definition at line 259 of file Dispatch.hpp.
References Lightweight::Driver::HasCatalogFunctions().
Referenced by Lightweight::Driver::HasCatalogFunctions().
|
inlinenoexcept |
Allocates a statement of the connection's driver and binds statement to that driver.
| connection | The connection to allocate on. |
| statement | Receives the statement; whatever it held before is forgotten, not freed. It is bound to the connection's driver whatever the result, and empty on failure. |
Definition at line 272 of file Dispatch.hpp.
References Lightweight::Driver::Allocate(), and Lightweight::Driver::AllocateStatement().
Referenced by Lightweight::Driver::AllocateStatement().
|
inlinenoexcept |
Frees the statement's driver handle and leaves statement empty, bound to the same driver.
| statement | The statement; may be empty. |
Definition at line 285 of file Dispatch.hpp.
References Lightweight::Driver::Free().
Referenced by Lightweight::Driver::Odbc::Free(), Lightweight::Driver::Sqlite3::Free(), and Lightweight::Driver::Free().
|
inlinenoexcept |
Gives up the statement's driver handle after its connection session ended, and leaves statement empty, bound to the same driver: what died with the session is not touched again, what the driver still holds for the statement is released (see each driver's Abandon).
| statement | The statement; may be empty. |
Definition at line 294 of file Dispatch.hpp.
References Lightweight::Driver::Abandon().
Referenced by Lightweight::Driver::Odbc::Abandon(), Lightweight::Driver::Sqlite3::Abandon(), and Lightweight::Driver::Abandon().
|
inlinenoexcept |
A second handle naming the same driver statement as statement (its driver struct copied, see SqlDriverHandleStruct): it owns nothing more, so only one of the two may free it.
| statement | The statement. |
Definition at line 303 of file Dispatch.hpp.
References Lightweight::Driver::Alias().
Referenced by Lightweight::Driver::Alias().
|
inlinenoexcept |
Tells whether two handles name the same driver statement.
| first | One handle. |
| second | The other handle. |
true when both are bound to the same driver and hold equal structs. Definition at line 312 of file Dispatch.hpp.
References Lightweight::Driver::SameStatement().
Referenced by Lightweight::Driver::SameStatement().
|
inline |
Prepares query on the statement.
| statement | The statement. |
| query | The SQL text, UTF-8. |
| wideQueryText | Whether the driver is to receive the text as UTF-16 (see SqlConnection::AcceptsWideQueryText()); a driver taking UTF-8 only ignores it. |
Definition at line 330 of file Dispatch.hpp.
References Prepare.
|
inlinenoexcept |
Executes the prepared statement with the currently bound parameters.
| statement | The statement. |
SqlResult::NoData for a searched UPDATE/DELETE that matched no rows. Definition at line 338 of file Dispatch.hpp.
References Execute.
|
inline |
Executes query directly, without preparing it.
| statement | The statement. |
| query | The SQL text, UTF-8. |
| wideQueryText | As for Prepare. |
Definition at line 348 of file Dispatch.hpp.
References ExecuteDirect.
|
inlinenoexcept |
Fetches the next row of the result set into the bound columns.
| statement | The statement. |
SqlResult::NoData past the last row. Definition at line 356 of file Dispatch.hpp.
References Fetch.
|
inlinenoexcept |
Advances to the next pending result set.
| statement | The statement. |
SqlResult::NoData when none is pending. Definition at line 364 of file Dispatch.hpp.
References Lightweight::Driver::MoreResults().
Referenced by Lightweight::Driver::Odbc::DiscardResults(), Lightweight::Driver::Odbc::MoreResults(), Lightweight::Driver::Sqlite3::MoreResults(), and Lightweight::Driver::MoreResults().
|
inlinenoexcept |
Closes the cursor of a result set that was read to its end. Pending result sets are left alone.
| statement | The statement. |
Definition at line 371 of file Dispatch.hpp.
References Lightweight::Driver::CloseCursor().
Referenced by Lightweight::Driver::Odbc::CloseCursor(), Lightweight::Driver::Sqlite3::CloseCursor(), and Lightweight::Driver::CloseCursor().
|
inlinenoexcept |
Drains every pending result set and closes the cursor, so the handle can run another query. An error met while draining is not reported.
| statement | The statement. |
Definition at line 379 of file Dispatch.hpp.
References Lightweight::Driver::DiscardResults().
Referenced by Lightweight::Driver::Odbc::DiscardResults(), Lightweight::Driver::Sqlite3::DiscardResults(), and Lightweight::Driver::DiscardResults().
|
inlinenoexcept |
Unbinds every bound result column.
| statement | The statement. |
Definition at line 387 of file Dispatch.hpp.
References Lightweight::Driver::UnbindColumns().
Referenced by Lightweight::Driver::Odbc::UnbindColumns(), Lightweight::Driver::Sqlite3::UnbindColumns(), and Lightweight::Driver::UnbindColumns().
|
inlinenoexcept |
Drops every parameter binding.
| statement | The statement. |
Definition at line 395 of file Dispatch.hpp.
References Lightweight::Driver::ResetParameters().
Referenced by Lightweight::Driver::Odbc::ResetParameters(), Lightweight::Driver::Sqlite3::ResetParameters(), and Lightweight::Driver::ResetParameters().
|
inlinenoexcept |
Restores single-row parameter binding after a parameter-array execution. Not reported.
| statement | The statement. |
Definition at line 402 of file Dispatch.hpp.
References Lightweight::Driver::ResetParameterArrays().
Referenced by Lightweight::Driver::Odbc::ResetParameterArrays(), Lightweight::Driver::Sqlite3::ResetParameterArrays(), and Lightweight::Driver::ResetParameterArrays().
|
inlinenoexcept |
Reports the number of columns of the current result set.
| statement | The statement. |
| count | Receives the column count (0 for a statement that produced no result set). |
Definition at line 411 of file Dispatch.hpp.
References Lightweight::Driver::NumResultColumns().
Referenced by Lightweight::Driver::Odbc::NumResultColumns(), Lightweight::Driver::Sqlite3::NumResultColumns(), and Lightweight::Driver::NumResultColumns().
|
inlinenoexcept |
Reports the number of parameters of the prepared statement.
| statement | The statement. |
| count | Receives the parameter count. |
Definition at line 420 of file Dispatch.hpp.
References Lightweight::Driver::NumParameters().
Referenced by Lightweight::Driver::Odbc::NumParameters(), Lightweight::Driver::Sqlite3::NumParameters(), and Lightweight::Driver::NumParameters().
|
inlinenoexcept |
Reports the number of rows the last executed statement affected.
| statement | The statement. |
| count | Receives the row count; -1 when the driver cannot tell. |
Definition at line 429 of file Dispatch.hpp.
References Lightweight::Driver::NumRowsAffected().
Referenced by Lightweight::Driver::Odbc::NumRowsAffected(), Lightweight::Driver::Sqlite3::NumRowsAffected(), and Lightweight::Driver::NumRowsAffected().
|
inline |
The SQL data type of a result column, as the driver describes it.
| statement | 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. Definition at line 439 of file Dispatch.hpp.
References Lightweight::Driver::ColumnType().
Referenced by Lightweight::Driver::Odbc::ColumnType(), Lightweight::Driver::Sqlite3::ColumnType(), and Lightweight::Driver::ColumnType().
|
inlinenoexcept |
Sets the query timeout of the statement.
| statement | The statement. |
| timeout | The timeout; zero means none. |
Definition at line 449 of file Dispatch.hpp.
References Lightweight::Driver::SetQueryTimeout().
Referenced by Lightweight::Driver::Odbc::SetQueryTimeout(), Lightweight::Driver::Sqlite3::SetQueryTimeout(), and Lightweight::Driver::SetQueryTimeout().
|
inlinenoexcept |
Reports the query timeout of the statement.
| statement | The statement. |
| timeout | Receives the timeout; zero means none. |
Definition at line 458 of file Dispatch.hpp.
References Lightweight::Driver::QueryTimeout().
Referenced by Lightweight::Driver::Odbc::QueryTimeout(), Lightweight::Driver::Sqlite3::QueryTimeout(), and Lightweight::Driver::QueryTimeout().
|
inline |
Reads the statement's diagnostics: the first record its last failed call left.
| statement | The statement. |
Definition at line 466 of file Dispatch.hpp.
References Lightweight::Driver::Diagnose().
Referenced by Lightweight::Driver::Sqlite3::Diagnose(), Lightweight::Driver::Diagnose(), and Lightweight::Driver::Odbc::ThrowBoundValueNotReadable().
|
inline |
Throws unless result indicates success: std::invalid_argument for a soft failure the caller is expected to recover from, SqlException otherwise (see ClassifyResult).
| statement | The statement result came from. |
| result | The result to check. |
| location | Where the check originated; the driver's fault seam sees it. Defaults to the caller's location. |
Definition at line 477 of file Dispatch.hpp.
References Lightweight::Driver::RequireSuccess().
Referenced by Lightweight::Driver::Sqlite3::RequireSuccess(), and Lightweight::Driver::RequireSuccess().
|
inline |
The non-throwing, fault-seam-aware verdict on result.
| statement | The statement result came from. |
| result | The result to check. |
| location | Where the check originated; the driver's fault seam sees it. |
Definition at line 489 of file Dispatch.hpp.
References Lightweight::Driver::CheckResult().
Referenced by Lightweight::Driver::Sqlite3::CheckResult(), Lightweight::Driver::Odbc::CheckResult(), Lightweight::Driver::CheckResult(), Lightweight::Driver::Sqlite3::CheckResult(), Lightweight::Driver::Odbc::CheckResult(), and Lightweight::Driver::CheckResult().
|
inline |
Opens the catalog result set request names on statement, in the layout the ODBC specification gives that catalog function.
| statement | The statement to open the result set on. |
| request | The catalog function and its arguments. |
SqlResult::Error, with the statement's diagnostics NotSupportedByDriver(id, "catalog access") (SQLSTATE IM001). Definition at line 502 of file Dispatch.hpp.
References Lightweight::Driver::OpenCatalog().
Referenced by Lightweight::Driver::Odbc::OpenCatalog(), Lightweight::Driver::Sqlite3::OpenCatalog(), and Lightweight::Driver::OpenCatalog().
|
inlinenoexcept |
The type a DATA_TYPE code of the driver's catalog result sets (see OpenCatalog) stands for.
| statement | The statement holding the catalog result set. |
| dataType | The code, as read from the result set. |
SqlResultColumnType::Unknown for a code without an enumerator, and on a driver without catalog functions. Definition at line 512 of file Dispatch.hpp.
References Lightweight::Driver::CatalogColumnType().
Referenced by Lightweight::Driver::Odbc::CatalogColumnType(), Lightweight::Driver::Sqlite3::CatalogColumnType(), and Lightweight::Driver::CatalogColumnType().
|
inline |
Describes a result column: its type and its size.
| statement | The statement, with a result set. |
| column | The 1-based result column. |
| description | Receives the description. |
Definition at line 522 of file Dispatch.hpp.
References Lightweight::Driver::DescribeColumn().
Referenced by Lightweight::Driver::Odbc::DeclaredBoundColumnSize(), Lightweight::Driver::Odbc::DescribeColumn(), Lightweight::Driver::Sqlite3::DescribeColumn(), Lightweight::Driver::Odbc::DescribeColumn(), and Lightweight::Driver::DescribeColumn().
|
inlinenoexcept |
The driver's own SQL type code of a result column, as the driver's leaf binders read it (see SqlDataBinderCallback::DescribeResultColumnType).
| statement | The statement, with a result set. |
| column | The 1-based result column. |
std::nullopt when the driver cannot describe the column, or has no such codes (its binders then never ask). Definition at line 535 of file Dispatch.hpp.
References Lightweight::Driver::DescribeResultColumnSqlType().
Referenced by Lightweight::Driver::Odbc::DescribeResultColumnSqlType(), Lightweight::Driver::Odbc::DescribeResultColumnSqlType(), Lightweight::Driver::Odbc::DescribeResultColumnSqlType(), Lightweight::Driver::Sqlite3::DescribeResultColumnSqlType(), and Lightweight::Driver::DescribeResultColumnSqlType().
|
inlinenoexcept |
The declared length of a result column as a bound buffer size (see SqlDataBinderCallback::MinimumOutputColumnSize).
| statement | The statement holding the result set. |
| column | The 1-based result column. |
| length | Which declared length to ask for. |
detail::DefaultBoundColumnSize where the driver reports no usable length. Definition at line 548 of file Dispatch.hpp.
References Lightweight::Driver::DeclaredBoundColumnSize().
Referenced by Lightweight::Driver::Odbc::DeclaredBoundColumnSize(), Lightweight::Driver::Sqlite3::DeclaredBoundColumnSize(), and Lightweight::Driver::DeclaredBoundColumnSize().
|
inlinenoexcept |
Restores single-row fetching after a row-array fetch. Not reported; nothing for a driver without row arrays.
| statement | The statement. |
Definition at line 558 of file Dispatch.hpp.
References Lightweight::Driver::ResetRowArrayAttributes().
Referenced by Lightweight::Driver::Odbc::ResetRowArrayAttributes(), Lightweight::Driver::Sqlite3::ResetRowArrayAttributes(), and Lightweight::Driver::ResetRowArrayAttributes().
|
inlinenoexcept |
Allocates the driver's connection resources, unless the connection already holds them.
| connection | The connection, bound to its driver. |
Definition at line 569 of file Dispatch.hpp.
References Lightweight::Driver::Allocate().
Referenced by Lightweight::Driver::Odbc::Allocate(), Lightweight::Driver::Sqlite3::Allocate(), Lightweight::Driver::Odbc::Allocate(), Lightweight::Driver::Sqlite3::Allocate(), Lightweight::Driver::Allocate(), and Lightweight::Driver::AllocateStatement().
|
inlinenoexcept |
Closes the connection: disconnects it, frees its driver resources and leaves connection empty, bound to the same driver. Not reported.
| connection | The connection; it must own its resources (not be borrowed). |
| diagnostic | Whether a refused disconnect's diagnostic is read (Skip for a connection never opened). |
Definition at line 580 of file Dispatch.hpp.
References Lightweight::Driver::Close().
Referenced by Lightweight::Driver::BindDriverFor(), Lightweight::Driver::Odbc::Close(), Lightweight::Driver::Sqlite3::Close(), and Lightweight::Driver::Close().
|
inlinenoexcept |
Ends the connection's session, keeping its driver resources for the next connect.
| connection | The connection; one that holds no session has nothing to end. |
Definition at line 589 of file Dispatch.hpp.
References Lightweight::Driver::Disconnect().
Referenced by Lightweight::Driver::Odbc::Disconnect(), Lightweight::Driver::Sqlite3::Disconnect(), and Lightweight::Driver::Disconnect().
|
inlinenoexcept |
Tells whether connection holds a driver connection (connected or not).
| connection | The connection. |
Definition at line 597 of file Dispatch.hpp.
References Lightweight::Driver::IsAllocated().
Referenced by Lightweight::Driver::Odbc::IsAllocated(), Lightweight::Driver::Sqlite3::IsAllocated(), and Lightweight::Driver::IsAllocated().
|
inlinenoexcept |
Tells whether the driver still considers the connection alive.
| connection | The connection. |
Definition at line 605 of file Dispatch.hpp.
References Lightweight::Driver::IsAlive().
Referenced by Lightweight::Driver::Odbc::IsAlive(), Lightweight::Driver::Sqlite3::IsAlive(), and Lightweight::Driver::IsAlive().
|
inline |
Reads the connection's diagnostics: the first record its last failed call left.
| connection | The connection. |
Definition at line 613 of file Dispatch.hpp.
References Lightweight::Driver::LastError().
Referenced by Lightweight::Driver::Odbc::LastError(), Lightweight::Driver::Sqlite3::LastError(), and Lightweight::Driver::LastError().
|
inline |
The non-throwing, fault-seam-aware verdict on result of a call on connection.
| connection | The connection result came from. |
| result | The result to check. |
| location | Where the check originated; the driver's fault seam sees it. |
Definition at line 623 of file Dispatch.hpp.
References Lightweight::Driver::CheckResult().
|
inline |
The name of the DBMS the connection is connected to.
| connection | The connected connection. |
Definition at line 633 of file Dispatch.hpp.
References Lightweight::Driver::ServerName().
Referenced by Lightweight::Driver::Odbc::ServerName(), Lightweight::Driver::Sqlite3::ServerName(), and Lightweight::Driver::ServerName().
|
inline |
The version of the DBMS the connection is connected to.
| connection | The connected connection. |
Definition at line 641 of file Dispatch.hpp.
References Lightweight::Driver::ServerVersion().
Referenced by Lightweight::Driver::Odbc::ServerVersion(), Lightweight::Driver::Sqlite3::ServerVersion(), and Lightweight::Driver::ServerVersion().
|
inline |
The name of the driver (library) the connection runs on.
| connection | The connected connection. |
Definition at line 649 of file Dispatch.hpp.
References Lightweight::Driver::DriverName().
Referenced by Lightweight::Driver::Odbc::DriverName(), Lightweight::Driver::Sqlite3::DriverName(), and Lightweight::Driver::DriverName().
|
inline |
The name of the database in use.
| connection | The connected connection. |
Definition at line 657 of file Dispatch.hpp.
References Lightweight::Driver::DatabaseName().
Referenced by Lightweight::Driver::Odbc::DatabaseName(), Lightweight::Driver::Sqlite3::DatabaseName(), and Lightweight::Driver::DatabaseName().
|
inline |
The name of the user the connection is logged in as.
| connection | The connected connection. |
Definition at line 665 of file Dispatch.hpp.
References Lightweight::Driver::UserName().
Referenced by Lightweight::Driver::Odbc::UserName(), Lightweight::Driver::Sqlite3::UserName(), and Lightweight::Driver::UserName().
|
inlinenoexcept |
Tells whether a transaction is open, i.e. autocommit is off.
| connection | The connection. |
Definition at line 673 of file Dispatch.hpp.
References Lightweight::Driver::TransactionActive().
Referenced by Lightweight::Driver::Odbc::TransactionActive(), Lightweight::Driver::Sqlite3::TransactionActive(), and Lightweight::Driver::TransactionActive().
|
inlinenoexcept |
Tells whether the data source supports transactions.
| connection | The connected connection. |
Definition at line 681 of file Dispatch.hpp.
References Lightweight::Driver::TransactionsAllowed().
Referenced by Lightweight::Driver::Odbc::TransactionsAllowed(), Lightweight::Driver::Sqlite3::TransactionsAllowed(), and Lightweight::Driver::TransactionsAllowed().
|
inlinenoexcept |
Switches autocommit mode on or off.
| connection | The connection. |
| enabled | Whether every statement commits on its own. |
Definition at line 690 of file Dispatch.hpp.
References Lightweight::Driver::SetAutoCommit().
Referenced by Lightweight::Driver::Odbc::SetAutoCommit(), Lightweight::Driver::Sqlite3::SetAutoCommit(), and Lightweight::Driver::SetAutoCommit().
|
inlinenoexcept |
Commits the open transaction.
| connection | The connection. |
Definition at line 698 of file Dispatch.hpp.
References Lightweight::Driver::Commit().
Referenced by Lightweight::Driver::Odbc::Commit(), Lightweight::Driver::Sqlite3::Commit(), and Lightweight::Driver::Commit().
|
inlinenoexcept |
Rolls back the open transaction.
| connection | The connection. |
Definition at line 706 of file Dispatch.hpp.
References Lightweight::Driver::Rollback().
Referenced by Lightweight::Driver::Odbc::Rollback(), Lightweight::Driver::Sqlite3::Rollback(), and Lightweight::Driver::Rollback().
|
inlinenoexcept |
Sets the transaction isolation level of the connection.
| connection | The connection. |
| mode | The isolation level; not SqlIsolationMode::DriverDefault. |
Definition at line 715 of file Dispatch.hpp.
References Lightweight::Driver::SetIsolation().
Referenced by Lightweight::Driver::Odbc::SetIsolation(), Lightweight::Driver::Sqlite3::SetIsolation(), and Lightweight::Driver::SetIsolation().
|
inlinenoexcept |
Rolls back the open transaction and switches autocommit back on.
| connection | The connection, with a transaction open. |
Definition at line 723 of file Dispatch.hpp.
References Lightweight::Driver::RollbackOpenTransaction().
Referenced by Lightweight::Driver::Odbc::RollbackOpenTransaction(), Lightweight::Driver::Sqlite3::RollbackOpenTransaction(), and Lightweight::Driver::RollbackOpenTransaction().
|
inline |
The string the driver escapes the wildcards of a catalog search pattern with (see OpenCatalog).
| connection | The connected connection. |
NotSupportedByDriver(id, "catalog access") (SQLSTATE IM001). Definition at line 732 of file Dispatch.hpp.
|
noexcept |
Tells whether connecting from Info binds handle to another driver than the one it is bound to.
| handle | The connection's handle. |
true when an enabled driver connects from Info and it is not the handle's; false otherwise, also when no enabled driver connects from Info. Definition at line 746 of file Dispatch.hpp.
References Lightweight::Driver::RebindsDriverFor().
Referenced by Lightweight::Driver::RebindsDriverFor().
|
noexcept |
Binds handle to the enabled driver D for which Connect(D::Connection&, Info const&, std::source_location) is well-formed (found by argument-dependent lookup), closing what the handle held if that was another driver's. No such driver: no change.
| handle | The connection's handle; it must own what it holds (not be borrowed). |
Definition at line 760 of file Dispatch.hpp.
References Lightweight::Driver::BindDriverFor(), and Lightweight::Driver::Close().
Referenced by Lightweight::Driver::BindDriverFor().
| std::expected< void, SqlErrorInfo > Lightweight::Driver::Connect | ( | ConnectionHandle & | handle, |
| Info const & | info, | ||
| std::source_location | location | ||
| ) |
Connects handle from info through the enabled driver that connects from it.
| handle | The connection's handle, bound by BindDriverFor and allocated by Allocate. |
| info | What to connect from. |
| location | Where the connect originated; the driver's fault seam sees it as the location of its connection checks. |
Info, or handle is bound to another driver: std::unexpected(NotSupportedByDriver(handle.DriverId(), "connecting from a <Info>")). Definition at line 782 of file Dispatch.hpp.
References Lightweight::Driver::Connect().
Referenced by Lightweight::Driver::Odbc::Connect(), Lightweight::Driver::Odbc::Connect(), Lightweight::Driver::Sqlite3::Connect(), and Lightweight::Driver::Connect().
|
inlinenoexcept |
Tells whether the connection's driver receives wide (UTF-16) query text unchanged.
| connection | The connected connection. |
true for a driver without the operation. Definition at line 805 of file Dispatch.hpp.
References Lightweight::Driver::AcceptsWideQueryText().
Referenced by Lightweight::Driver::Odbc::AcceptsWideQueryText(), and Lightweight::Driver::AcceptsWideQueryText().
|
inlinenoexcept |
Tells whether the connection's driver can read a bound output column again, so that a bound value longer than its buffer is read in full (see SqlConnection::ReadsBoundColumnsAgain).
| connection | The connected connection. |
true for a driver without the operation, which fills a bound column afresh for every row and so never cuts a value off. Definition at line 820 of file Dispatch.hpp.
References Lightweight::Driver::ReadsBoundColumnsAgain().
Referenced by Lightweight::Driver::Odbc::ReadsBoundColumnsAgain(), and Lightweight::Driver::ReadsBoundColumnsAgain().
|
inline |
Tells how the narrow string binders exchange text with the connection's driver (see SqlConnection::NarrowTextBindingMode).
| connection | The connected connection. |
| serverType | The connected backend. |
| connectInfo | What the connection was connected from. |
detail::NarrowTextBindingOf(serverType) for a driver without the operation. Definition at line 836 of file Dispatch.hpp.
|
inline |
Names the driver a connect from connectionString reaches, without connecting (see ServerTypeFromDriverName): the connection string's own DRIVER, else what the driver manager lists for its DSN.
| connection | The connection, allocated. |
| connectionString | The connection string to connect from. |
Definition at line 855 of file Dispatch.hpp.
References Lightweight::Driver::DriverNameOf().
Referenced by Lightweight::Driver::Odbc::DriverNameOf(), and Lightweight::Driver::DriverNameOf().
|
inlinenoexcept |
Records whether the connection's driver takes text through its wide entry points, where the driver has such a choice; does nothing otherwise.
| connection | The connected connection. |
| acceptsWideQueryText | What AcceptsWideQueryText found. |
Definition at line 871 of file Dispatch.hpp.
References Lightweight::Driver::RegisterTextEntry().
Referenced by Lightweight::Driver::Odbc::RegisterTextEntry(), and Lightweight::Driver::RegisterTextEntry().
|
inlinenoexcept |
Records statement as belonging to a connection whose driver takes text only through its ANSI entry points, where the driver has such a choice; does nothing otherwise.
| statement | The freshly allocated statement. |
| connection | The connection it was allocated on. |
Definition at line 883 of file Dispatch.hpp.
References Lightweight::Driver::RegisterAnsiOnly().
Referenced by Lightweight::Driver::Odbc::RegisterAnsiOnly(), and Lightweight::Driver::RegisterAnsiOnly().
|
inline |
Describes the declared SQL type of each of the first count parameters.
| statement | The prepared statement. |
| count | The number of parameters to describe. |
Definition at line 897 of file Dispatch.hpp.
References Lightweight::Driver::DescribeParameterTypes().
Referenced by Lightweight::Driver::Odbc::DescribeParameterTypes(), and Lightweight::Driver::DescribeParameterTypes().
|
inlinenoexcept |
The number of parameters currently bound on the statement.
| statement | The statement. |
Definition at line 910 of file Dispatch.hpp.
References Lightweight::Driver::BoundParameterCount().
Referenced by Lightweight::Driver::Odbc::BoundParameterCount(), and Lightweight::Driver::BoundParameterCount().
| void Lightweight::Driver::VisitIfSupported | ( | Handle && | handle, |
| F && | f | ||
| ) |
Calls f with the held struct when f is invocable with it; otherwise does nothing.
| handle | The statement or connection handle. |
| f | The callable, e.g. taking one driver's struct only. |
Definition at line 929 of file Dispatch.hpp.
References Lightweight::Driver::VisitIfSupported().
Referenced by Lightweight::Driver::VisitIfSupported().
| decltype(auto) Lightweight::Driver::VisitRequired | ( | Handle && | handle, |
| std::string_view | operation, | ||
| F && | f | ||
| ) |
Calls f with the held struct when invocable; otherwise throws SqlException(NotSupportedByDriver(id, operation)).
| handle | The statement or connection handle. |
| operation | The name of the operation f performs, for the error message. |
| f | The callable, e.g. taking one driver's struct only. |
f returns. Definition at line 945 of file Dispatch.hpp.
References Lightweight::Driver::VisitRequired().
Referenced by Lightweight::Driver::Odbc::RestoreBoundBuffer(), and Lightweight::Driver::VisitRequired().
|
inlineconstexpr |
Whether a connection opened from the default connect info refuses to connect while no default was set (see SqlConnection::SetDefaultConnectInfo): with SQLSTATE 08001 instead of opening what the unset default names. Holds in a build without the ODBC driver, whose unset default would be a SqliteConnectInfo naming a private temporary database. With ODBC the unset default is an empty connection string, which the driver manager refuses itself.
Definition at line 207 of file Dispatch.hpp.