|
constexpr | Connection () noexcept |
|
Descriptor | CreateDescriptor () const |
|
void | BrowseConnect (const SQLWCHAR *inputConnectionString, SQLSMALLINT inputConnectionStringLength, SQLWCHAR *resultConnectionString, SQLSMALLINT resultConnectionStringMaxLength, SQLSMALLINT *resultConnectionStringActualLength) const |
|
void | BrowseConnect (const SQLCHAR *inputConnectionString, SQLSMALLINT inputConnectionStringLength, SQLCHAR *resultConnectionString, SQLSMALLINT resultConnectionStringMaxLength, SQLSMALLINT *resultConnectionStringActualLength) const |
|
Result | Connect (const SQLWCHAR *datasourceName, SQLSMALLINT datasourceNameLength, const SQLWCHAR *userName, SQLSMALLINT userNameLength, const SQLWCHAR *authenticationString, SQLSMALLINT authenticationStringLength) const |
|
Result | Connect (const SQLCHAR *datasourceName, SQLSMALLINT datasourceNameLength, const SQLCHAR *userName, SQLSMALLINT userNameLength, const SQLCHAR *authenticationString, SQLSMALLINT authenticationStringLength) const |
|
template<SimpleStringLike StringT> |
Result | Connect (const StringT &datasourceName) const |
|
template<SimpleStringLike StringT1, SimpleStringLike StringT2> |
Result | Connect (const StringT1 &datasourceName, const StringT2 &userName) const |
|
template<SimpleStringLike StringT1, SimpleStringLike StringT2, SimpleStringLike StringT3> |
Result | Connect (const StringT1 &datasourceName, const StringT2 &userName, const StringT3 &authenticationString) const |
|
ODBC::Statement | CreateStatement () const |
|
Result | Disconnect () const |
|
Result | DriverConnect (SQLHWND windowHandle, const SQLWCHAR *initialConnectionString, SQLSMALLINT initialConnectionStringLength, SQLWCHAR *resultConnectionString, SQLSMALLINT resultConnectionStringMaxLength, SQLSMALLINT *resultConnectionStringActualLength, ODBC::DriverCompletion driverCompletion) const |
|
Result | DriverConnect (SQLHWND windowHandle, const SQLCHAR *initialConnectionString, SQLSMALLINT initialConnectionStringLength, SQLCHAR *resultConnectionString, SQLSMALLINT resultConnectionStringMaxLength, SQLSMALLINT *resultConnectionStringActualLength, ODBC::DriverCompletion driverCompletion) const |
|
Result | EndTransaction (ODBC::TransactionCompletionType completionType) const |
|
Result | Commit () const |
|
Result | Rollback () const |
|
Result | GetAttributeW (SQLINTEGER attributeId, SQLPOINTER value, SQLINTEGER valueBufferLength, SQLINTEGER *valueActualLength) const |
|
UInt64 | GetUInt64Attribute (SQLINTEGER attributeId) const |
|
Int64 | GetInt64Attribute (SQLINTEGER attributeId) const |
|
SQLPOINTER | GetPointerAttribute (SQLINTEGER attributeId) const |
|
bool | GetBooleanAttribute (SQLINTEGER attributeId) const |
|
ODBC::Descriptor | GetDescriptorAttribute (SQLINTEGER attributeId) const |
|
template<typename T >
requires std::is_enum_v<T> |
T | GetEnumAttribute (SQLINTEGER attributeId) const |
|
WideString | GetWideStringAttribute (SQLINTEGER attributeId) const |
|
Result | GetAttributeA (SQLINTEGER attributeId, SQLPOINTER value, SQLINTEGER valueBufferLength, SQLINTEGER *valueActualLength) const |
|
Result | SetAttributeW (SQLINTEGER attributeId, SQLPOINTER value, SQLINTEGER valueLength) const |
|
Result | SetUInt64Attribute (SQLINTEGER attributeId, UInt64 value) const |
|
Result | SetInt64Attribute (SQLINTEGER attributeId, Int64 value) const |
|
Result | SetBooleanAttribute (SQLINTEGER attributeId, bool value) const |
|
Result | SetPointerAttribute (SQLINTEGER attributeId, SQLPOINTER value) const |
|
Result | SetDescriptorAttribute (SQLINTEGER attributeId, SQLHANDLE value) const |
|
Result | SetDescriptorAttribute (SQLINTEGER attributeId, const Descriptor &value) const |
|
template<typename T >
requires std::is_enum_v<T> |
Result | SetEnumAttribute (SQLINTEGER attributeId, T value) const |
|
template<SimpleWideStringLike StringT> |
Result | SetWideStringAttribute (SQLINTEGER attributeId, const StringT &value) const |
|
Result | SetAttributeA (SQLINTEGER attributeId, SQLPOINTER value, SQLINTEGER valueLength) const |
|
Result | SetAccessMode (ODBC::AccessMode accessMode) const |
|
ODBC::AccessMode | AccessMode () const |
|
Result | SetAsyncEvent (const EventWaitHandle &eventWaitHandle) const |
|
Result | SetAsyncEvent (HANDLE eventWaitHandle) const |
|
HANDLE | AsyncEvent () const |
|
Result | SetAsyncConnectionFunctionsEnabled (bool asyncEnable) const |
|
bool | AsyncConnectionFunctionsEnabled () const |
|
Result | SetAsyncEnabled (bool asyncEnable) const |
|
bool | AsyncEnabled () const |
|
bool | SupportsAutoPopulateImplementationParameterDescriptor () const |
|
Result | SetAutoCommit (bool autoCommit) const |
|
bool | AutoCommit () const |
|
bool | ConnectionDead () const |
|
bool | Connected () const |
|
Result | SetDTCTransaction (ITransaction *transaction) const |
|
template<SimpleWideStringLike StringT> |
Result | SetCurrentCatalog (const StringT ¤tCatalog) const |
|
WideString | CurrentCatalog () const |
|
Result | SetAutoCommitMode (bool enabled) const |
|
bool | AutoCommitMode (bool enabled) const |
|
Result | GetFunctions (SQLUSMALLINT functionId, SQLUSMALLINT *supported) const |
|
Result | GetInfoW (SQLUSMALLINT infoType, SQLPOINTER infoValue, SQLSMALLINT infoValueMaxLength, SQLSMALLINT *infoValueActualLength) const |
|
Result | GetInfoA (SQLUSMALLINT infoType, SQLPOINTER infoValue, SQLSMALLINT infoValueMaxLength, SQLSMALLINT *infoValueActualLength) const |
|
Result | NativeSql (const SQLWCHAR *inStatement, SQLINTEGER inStatementLength, SQLWCHAR *outStatement, SQLINTEGER outStatementMaxLength, SQLINTEGER *outStatementActualLength) const |
|
Result | NativeSql (const SQLCHAR *inStatement, SQLINTEGER inStatementLength, SQLCHAR *outStatement, SQLINTEGER outStatementMaxLength, SQLINTEGER *outStatementActualLength) const |
|
Public Member Functions inherited from Harlinn::ODBC::SqlHandle< ODBC::HandleType::Connection > |
constexpr | SqlHandle () noexcept |
|
| SqlHandle (const SqlHandle &other)=delete |
|
constexpr | SqlHandle (SqlHandle &&other) noexcept |
|
| ~SqlHandle () |
|
SqlHandle & | operator= (const SqlHandle &other)=delete |
|
constexpr SqlHandle & | operator= (SqlHandle &&other) noexcept |
|
constexpr SQLHANDLE | Handle () const noexcept |
|
void | Close () noexcept |
|
Result | Cancel () const |
|
Result | CompleteAsync (RETCODE *asyncRetCode) const |
|
The Connection class is a wrapper for the ODBC connection handle.
A connection consists of a driver and a data source. A connection handle identifies each connection. The connection handle defines not only which driver to use but which data source to use with that driver. Within a segment of code that implements ODBC (the Driver Manager or a driver), the connection handle identifies a structure that contains connection information, such as the following:
-
The state of the connection
-
The current connection-level diagnostics
-
The handles of statements and descriptors currently allocated on the connection
-
The current settings of each connection attribute
ODBC does not prevent multiple simultaneous connections, if the driver supports them. Therefore, in a particular ODBC environment, multiple connection handles might point to a variety of drivers and data sources, to the same driver and a variety of data sources, or even to multiple connections to the same driver and data source. Some drivers limit the number of active connections they support; the SQL_MAX_DRIVER_CONNECTIONS option in SQLGetInfo specifies how many active connections a particular driver supports.
Connection handles are primarily used when connecting to the data source (SQLConnect, SQLDriverConnect, or SQLBrowseConnect), disconnecting from the data source (SQLDisconnect), getting information about the driver and data source (SQLGetInfo), retrieving diagnostics (SQLGetDiagField and SQLGetDiagRec), and performing transactions (SQLEndTran). They are also used when setting and getting connection attributes (SQLSetConnectAttr and SQLGetConnectAttr) and when getting the native format of an SQL statement (SQLNativeSql).
Connection handles are allocated with SQLAllocHandle and freed with SQLFreeHandle.