[ODBC-395] Tansaction Isolation Level is not applied if set before connect Created: 2023-07-20  Updated: 2023-07-23  Resolved: 2023-07-23

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.19
Fix Version/s: 3.2.1, 3.1.20

Type: Bug Priority: Major
Reporter: Lawrin Novitsky Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: 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"));


Generated at Thu Feb 08 03:28:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.