pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ludek Finstrle <luf@pzkagis.cz>
To: pgsql-odbc@postgresql.org
Subject: Re: patch: implicit rollback
Date: Sat, 14 Jan 2006 22:47:24 +0100
Message-ID: <20060114214724.GA21337@soptik.pzkagis.cz> (raw)
In-Reply-To: <20060112141420.GB7886@soptik.pzkagis.cz>
References: <20060112141420.GB7886@soptik.pzkagis.cz>

>   there is still bug in implicit rollback. I try solve it better.
> Patch is attached.

I think there is one problem. We have to unset abort flag when
no abort is done when res is non-null.

New patch attached (this new one is in 08.01.0107 dev snapshot).

Please review and comment

Luf

Attachments:

psqlodbc-implicit_rollback.diff (text/plain, 4.0K) download diff -c psqlodbc.orig\connection.c psqlodbc\connection.c *** psqlodbc.orig\connection.c Sun Jan 08 12:12:01 2006 --- psqlodbc\connection.c Thu Jan 12 14:53:34 2006 *************** *** 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) --- 1474,1489 ---- { 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) diff -c psqlodbc.orig\statement.c psqlodbc\statement.c *** psqlodbc.orig\statement.c Sat Dec 10 08:39:31 2005 --- psqlodbc\statement.c Thu Jan 12 15:32:57 2006 *************** *** 590,596 **** * transaction. */ conn = SC_get_conn(self); ! if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) { if (SC_is_pre_executable(self) && !conn->connInfo.disallow_premature) CC_abort(conn); --- 590,597 ---- * transaction. */ conn = SC_get_conn(self); ! if (CC_is_in_trans(conn) && !CC_is_in_autocommit(conn) && ! !CC_is_in_manual_trans(conn)) { if (SC_is_pre_executable(self) && !conn->connInfo.disallow_premature) CC_abort(conn); *************** *** 1180,1190 **** auto_begin = TRUE; if (PG_VERSION_GE(conn, 7.1)) qflag |= GO_INTO_TRANSACTION; ! else if (!CC_begin(conn)) ! { SC_set_error(self, STMT_EXEC_ERROR, "Could not begin a transaction"); goto cleanup; ! } } oldstatus = conn->status; --- 1181,1191 ---- auto_begin = TRUE; if (PG_VERSION_GE(conn, 7.1)) qflag |= GO_INTO_TRANSACTION; ! else if (!CC_begin(conn)) ! { SC_set_error(self, STMT_EXEC_ERROR, "Could not begin a transaction"); goto cleanup; ! } } oldstatus = conn->status; *************** *** 1251,1257 **** */ if (CC_is_in_trans(conn)) { ! if (!is_in_trans) CC_set_in_manual_trans(conn); if (!self->internal && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn)) CC_commit(conn); --- 1252,1258 ---- */ if (CC_is_in_trans(conn)) { ! if (!is_in_trans && !auto_begin) CC_set_in_manual_trans(conn); if (!self->internal && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn)) CC_commit(conn); *************** *** 1288,1294 **** /* issue "ABORT" when query aborted */ if (QR_get_aborted(res)) { ! if (!self->internal) CC_abort(conn); } else --- 1289,1297 ---- /* issue "ABORT" when query aborted */ if (QR_get_aborted(res)) { ! if (!self->internal && CC_is_in_trans(conn) && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn)) CC_abort(conn); + else + QR_set_aborted(res, FALSE); } else *************** *** 1335,1341 **** SC_set_error(self, STMT_EXEC_ERROR, CC_get_errormsg(conn)); } ! if (!self->internal) CC_abort(conn); } if (!SC_get_Result(self)) --- 1336,1342 ---- SC_set_error(self, STMT_EXEC_ERROR, CC_get_errormsg(conn)); } ! if (!self->internal && CC_is_in_trans(conn) && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn)) CC_abort(conn); } if (!SC_get_Result(self))

view thread (2+ messages)

Message-ID: <20060114214724.GA21337@soptik.pzkagis.cz>
Permalink:  ../20060114214724.GA21337@soptik.pzkagis.cz/
Also on:    postgresql.org/message-id/20060114214724.GA21337@soptik.pzkagis.cz

 ·  · 

reply

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: implicit rollback
  In-Reply-To: <20060114214724.GA21337@soptik.pzkagis.cz>
  References: <20060112141420.GB7886@soptik.pzkagis.cz> <20060114214724.GA21337@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