From: Ludek Finstrle <luf@pzkagis.cz>
To: pgsql-odbc@postgresql.org
Subject: patch for [ psqlodbc-Bugs-1000498 ] rollback to savepoint in case of error
Date: Sat, 24 Dec 2005 10:35:43 +0100
Message-ID: <20051224093543.GA14222@soptik.pzkagis.cz> (raw)
In-Reply-To: <20051223093549.C2A7F112506C@pgfoundry.org>
References: <20051223093549.C2A7F112506C@pgfoundry.org>
Fri, Dec 23, 2005 at 09:35:49AM +0000, noreply@pgfoundry.org napsal(a):
> Bugs item #1000498, was opened at 2005-12-21 15:19
>
> Why does an error breaks the savepoint environment ?
I fix this problem this way:
abort after query failed is examined only if there is autocommit on and
not running manual transaction.
Patch is attached. It could be applied only after psqlodbc-sqlstate.diff.
Please review and comment
Luf
Attachments:psqlodbc-transact_abort.diff (text/plain, 1.3K) download
diff -c psqlodbc.orig\connection.c psqlodbc\connection.c
*** psqlodbc.orig\connection.c Sat Dec 24 11:29:39 2005
--- psqlodbc\connection.c Sat Dec 24 11:13:31 2005
***************
*** 1506,1521 ****
{
if ((res->status == PGRES_EMPTY_QUERY) || (res->status == PGRES_BAD_RESPONSE))
{
! mylog("send_query: sending query failed -> abort\n");
! QR_set_aborted(res, TRUE);
QR_Destructor(res);
res = NULL;
goto cleanup;
}
else if (res->status == PGRES_FATAL_ERROR)
{
! mylog("send_query: sended query failed -> abort\n");
! QR_set_aborted(res, TRUE);
goto cleanup;
}
if (create_keyset)
--- 1506,1527 ----
{
if ((res->status == PGRES_EMPTY_QUERY) || (res->status == PGRES_BAD_RESPONSE))
{
! if (CC_is_in_autocommit(self) && !CC_is_in_manual_trans(self))
! {
! mylog("send_query: sending query failed -> abort\n");
! QR_set_aborted(res, TRUE);
! }
QR_Destructor(res);
res = NULL;
goto cleanup;
}
else if (res->status == PGRES_FATAL_ERROR)
{
! if (CC_is_in_autocommit(self) && !CC_is_in_manual_trans(self))
! {
! mylog("send_query: sended query failed -> abort\n");
! QR_set_aborted(res, TRUE);
! }
goto cleanup;
}
if (create_keyset)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: luf@pzkagis.cz
Subject: Re: patch for [ psqlodbc-Bugs-1000498 ] rollback to savepoint in case of error
In-Reply-To: <20051224093543.GA14222@soptik.pzkagis.cz>
References: <20051223093549.C2A7F112506C@pgfoundry.org> <20051224093543.GA14222@soptik.pzkagis.cz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox