diff options
author | Hiroshi Inoue | 2009-04-04 10:44:47 +0000 |
---|---|---|
committer | Hiroshi Inoue | 2009-04-04 10:44:47 +0000 |
commit | 09a083ea67399a649d36874afd73f7e526fa433f (patch) | |
tree | d2a5052a109392e3a95ec1c2f8998f0dd9e40ded /options.c | |
parent | c6a37108f8298ad1574a3ab9d3555b44720bd541 (diff) |
Improve the transactional control under useDeclareFetch mode.
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -400,13 +400,8 @@ PGAPI_SetConnectOption( case SQL_QUIET_MODE: /* ignored */ break; - case SQL_TXN_ISOLATION: /* ignored */ + case SQL_TXN_ISOLATION: retval = SQL_SUCCESS; - if (CC_is_in_trans(conn)) - { - CC_set_error(conn, CONN_TRANSACT_IN_PROGRES, "Cannot switch isolation level while a transaction is in progress", func); - return SQL_ERROR; - } if (conn->isolation == vParam) break; switch (vParam) @@ -441,6 +436,16 @@ PGAPI_SetConnectOption( char *query; QResultClass *res; + if (CC_is_in_trans(conn)) + { + if (CC_does_autocommit(conn) && !CC_is_in_error_trans(conn)) + CC_commit(conn); + else + { + CC_set_error(conn, CONN_TRANSACT_IN_PROGRES, "Cannot switch isolation level while a transaction is in progress", func); + return SQL_ERROR; + } + } switch (vParam) { case SQL_TXN_SERIALIZABLE: |