X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5061F9DC847 for ; Sat, 24 Dec 2005 05:35:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41644-06 for ; Sat, 24 Dec 2005 05:35:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.pzkagis.cz (gis6.netbox.cz [83.240.30.214]) by postgresql.org (Postfix) with ESMTP id C661E9DC944 for ; Sat, 24 Dec 2005 05:35:43 -0400 (AST) Received: (from luf@localhost) by smtp.pzkagis.cz (8.11.6/8.11.6) id jBO9ZhZ14231 for pgsql-odbc@postgresql.org; Sat, 24 Dec 2005 10:35:43 +0100 Date: Sat, 24 Dec 2005 10:35:43 +0100 From: Ludek Finstrle To: pgsql-odbc@postgresql.org Subject: patch for [ psqlodbc-Bugs-1000498 ] rollback to savepoint in case of error Message-ID: <20051224093543.GA14222@soptik.pzkagis.cz> References: <20051223093549.C2A7F112506C@pgfoundry.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline In-Reply-To: <20051223093549.C2A7F112506C@pgfoundry.org> User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.05 required=5 tests=[AWL=0.050] X-Spam-Score: 0.05 X-Spam-Level: X-Archive-Number: 200512/313 X-Sequence-Number: 6792 --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="psqlodbc-transact_abort.diff" 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) --bp/iNruPH9dso1Pn--