Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9B73F4754A6 for ; Mon, 19 Aug 2002 04:54:24 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 1B6EA4754A3 for ; Mon, 19 Aug 2002 04:54:24 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 86A5438190D; Mon, 19 Aug 2002 04:54:23 -0400 (EDT) From: =?ISO-8859-1?Q?Bj=F6rn?= Lundin X-Newsgroups: comp.databases.postgresql.interfaces Subject: Re: determining if there's a transaction in progress Date: Mon, 19 Aug 2002 10:54:58 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 22 Message-ID: References: <3D5DD515.4070302@cogeco.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: news@hub.org User-Agent: KNode/0.7.1 To: pgsql-interfaces@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/66 X-Sequence-Number: 3028 Warren W. Gay VE3WWG wrote: > I too could benefit from a libpq feature that indicates if a transaction > is pending. This > helps in determining in a destructor (or Ada finalization) whether the > default action > to rollback/commit is necessary (rather than depend upon the server > default action). > Assuming it is always necessary is clumsy, and imposes unnecessary > overhead in > situations where a transaction may not be in progress. In Ada, you could keep track of transaction state in a package. Put 'start_trans', 'commit' and 'rollback' procedures that changes the transaction state accordingly. You'll then need a function 'trans_in_progress' to check it Example at http://home.swipnet.se/lundin/ada_95_tools.html /Björn