summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
authorHiroshi Inoue2009-04-04 10:44:47 +0000
committerHiroshi Inoue2009-04-04 10:44:47 +0000
commit09a083ea67399a649d36874afd73f7e526fa433f (patch)
treed2a5052a109392e3a95ec1c2f8998f0dd9e40ded /options.c
parentc6a37108f8298ad1574a3ab9d3555b44720bd541 (diff)
Improve the transactional control under useDeclareFetch mode.
Diffstat (limited to 'options.c')
-rw-r--r--options.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/options.c b/options.c
index e0267af..608e27c 100644
--- a/options.c
+++ b/options.c
@@ -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: