The EDS environment can be in one of four states:
State |
Condition |
S0 |
unallocated environment |
S1 |
allocated environment |
S2 |
allocated HDBC |
S3 |
connected HDBC |
The following table lists the next valid state for each core command when called from a given state. InvHndl indicates an INVALID_HANDLE return code.
Core Commands |
S0 unallocated HENV |
S1 allocated HENV |
S2 allocated HDBC |
S3 connected HDBC |
EDSAllocEnv |
S1 |
S11 |
S11 |
S11 |
EDSAllocConnect InvHndl |
S2 |
S21 |
S21 |
|
EDSConnect |
InvHndl |
InvHndl |
S3 |
*08002* |
EDSDisconnect |
InvHndl |
InvHndl |
*08003* |
S2 *25000*2 |
EDSFreeConnect |
InvHndl |
InvHndl |
S1 |
*S1010* |
EDSFreeEnv |
InvHndl |
S0 |
*S1010* |
*S1010* |
EDSTransact |
InvHndl |
InvHndl |
*08003* |
S3 |
The following table lists the next valid state for each extended command when called from a given state. InvHndl indicates an INVALID_HANDLE return code.
Extended Commands |
S0 |
S1 |
S2 |
S3 |
EDSBrowseConnect |
InvHndl |
InvHandl |
S33 |
*08002* |
EDSDataSources |
InvHndl |
S1 |
S2 |
S3 |
EDSDriverConnect |
InvHndl |
InvHndl |
S3 |
*08002* |
EDSGetConnectOption |
InvHndl |
InvHndl |
S2 |
S3 |
EDSGetFunctions |
InvHndl |
InvHndl |
*S1010* |
S3 |
EDSGetInfo |
InvHndl |
InvHndl |
S24 *08003* |
S3 |
EDSNativeSql |
InvHndl |
InvHndl |
*08003* |
S3 |
EDSSetConnectOption |
InvHndl |
InvHndl |
S2 |
S3 |
1Allocation functions should never be called for already-allocated handles, as the driver will lose any information associated with the handle and the handle will return to the allocated state (S1).
2EDSDisconnect returns a SQLSTATE of 25000 (Invalid transaction state) only if there is an incomplete transaction associated with the HDBC.
3The HDBC is not in a connected state until EDSBrowseConnect returns EDS_SUCCESS or EDS_SUCCESS_WITH_INFO. Until then, EDSBrowseConnect; may be called repeatedly on the HDBC. However, calling EDSConnect or EDSDriverConnect on an HDBC that is being browsed will return an SQLSTATE of 08002 (Connection in use).
4Transition for information option EDS_ODBC_VER, which can be returned by the Driver Manager. Otherwise, the Driver Manager returns EDS_ERROR with an SQLSTATE of 08003 (Connection not open).