dtl
![]() |
![]() |
Category: utilities | Component type: type |
The DBConnection class provides a mechanism to manage ODBC connections to a database.
Defined in the DBConnection.h header file.
None.
None.
int main(int argc, char **argv)
{
DBConnection::GetDefaultConnection().Connect("UID=example;PWD=example;DSN=example;");
}
X | A type that is a model of DBConnection |
a | Object of type X |
Name | Expression | Precondition | Semantics | Postcondition |
---|---|---|---|---|
Constructor | X a() |
Creates an empty database connection object. The connection object cannot be used until it has been intialized with a Connect() call | ||
Connection Constructor | Connect(string &s) |
Creates a database connection using the ODBC connect string contained in s | valid database connection - throw if error encountered | |
Get the default connection object | GetDefaultConnection() |
Get the default connection object. Returns a static member of the DBConnection class used to hold the default connection object for the library. This default connection object is used as the default connection object by DBStmt, DBView and IndexedDBView if no explicit connection parameter is specified in their constructors. | ||
Commit all outstanding transactions | CommitAll() |
Commit all outstanding transactions against the database. | ||
Commit all outstanding transactions | RollbackAll() |
Rollback all outstanding transactions against the database. | ||
Get the raw ODBC HENV handle for the connection | HENV GetHENV() |
Returns the raw ODBC HENV handle. | ||
Get the raw ODBC HDBC handle for the connection | HDBC GetHDBC() |
Returns the raw ODBC HDBC handle. | ||
Get the DSN string used by the connection. | string GetDSN() |
Returns the raw ODBC DSN string used by the connection. | ||
Swap with another connection | void swap(DBConnection &other) |
Swap *this with other. |
DBStmt, DBView, IndexedDBView, ValidatedObject
Copyright © 2001, Michael Gradman and Corwin Joy.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Corwin Joy and Michael Gradman make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.