Transaction and Connection Termination Procedures
Each query object that runs in ODBC creates a transaction. To ensure that all memory that is associated with a transaction is freed and locks are released, an application should call SQLTransact.
Syntax
RETCODE SQLTransact(henv,hdbc,fType)
Description
SQLTransact requests a commit or rollback operation for all active operations on all statement handles that are associated with a connection. SQLTransact can also request that a commit or rollback operation be performed for all connections that are associated with the environment handle. In the case of query objects, the transaction is automatically closed upon termination of the statement handle.
Parameters
This table describes the parameters:
Argument |
Type |
Use |
Description |
---|---|---|---|
henv |
HENV |
Input |
Environment handle or SQL_NULL_HENV. |
hdbc |
HDBC |
Input |
Connection handle or SQL_NULL_HDBC. |
fType |
UWORD |
Input |
Flag for SQL_COMMIT or SQL_ROLLBACK. |
Syntax
RETCODE SQLDisconnect(hdbc)
Description
SQLDisconnect closes the connection that is associated with a specific connection handle.
If an application calls SQLDisconnect before it has freed all statement handles that are associated with the connection, the driver frees those statement handles after it successfully disconnects from the data source. However, if one or more of the statement handles that are associated with the connection are still executing asynchronously, SQLDisconnect will return SQL_ERROR.
Parameters
This table describes the parameter:
Argument |
Type |
Use |
Description |
---|---|---|---|
hdbc |
HDBC |
Input |
Connection handle. |
Syntax
RETCODE SQLFreeConnect(hdbc)
Description
SQLFreeConnect releases a connection handle and frees all memory that is associated with the handle. This is called after SQLDisconnect.
Parameters
This table describes the parameter:
Argument |
Type |
Use |
Description |
---|---|---|---|
hdbc |
HDBC |
Input |
Connection handle. |
Syntax
RETCODE SQLFreeEnv(henv)
Description
SQLFreeEnv frees the environment handle and releases all memory that is associated with the environment handle.
Parameters
This table describes the parameter:
Argument |
Type |
Use |
Description |
---|---|---|---|
henv |
HENV |
Input |
Environment handle. |