Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.1.19
-
None
Description
Specs allow SQL_ATTR_TXN_ISOLATION connection attribute to be set before connection, but if application does that, the driver won't apply it to the established connection.
The code for illustration
SQLAllocHandle(SQL_HANDLE_DBC, Env, dbc);
|
CHECK_DBC_RC(dbc, SQLSetConnectAttr(dbc, SQL_ATTR_TXN_ISOLATION,
|
(SQLPOINTER)SQL_TXN_READ_COMMITTED, 0)); |
|
SQLDriverConnect(dbc,...);
|
SQLAllocHandle(SQL_HANDLE_STMT, dbc, Stmt);
|
|
/* Checking that after connection we have that isolation level */ |
CHECK_DBC_RC(dbc, SQLGetConnectAttr(dbc, SQL_ATTR_TXN_ISOLATION, &isolation,
|
SQL_IS_POINTER, NULL));
|
// Here it's gonna be fine
|
is_num(isolation, SQL_TXN_READ_COMMITTED);
|
|
OK_SIMPLE_STMT(Stmt, "SELECT @@transaction_isolation");// or @@tx_isolation |
|
SQLFetch(Stmt);
|
// Here the value won't be really "READ-COMMITTED" |
IS_STR("READ-COMMITTED", my_fetch_str(Stmt1, buffer, 1), sizeof("READ-COMMITTED")); |