pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feeddetermining if there's a transaction in progress
4+ messages / 4 participants
[nested] [flat]
* determining if there's a transaction in progress
@ 2002-08-16 13:54 Daniel Kelley <dkelley@otec.com>
2002-08-16 18:11 ` Re: determining if there's a transaction in progress Steve Howe <howe@carcass.dhs.org>
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kelley @ 2002-08-16 13:54 UTC (permalink / raw)
To: pgsql-interfaces
hi-
i'm using libpq. is there any way to determine if there is a transaction
is process thru libpq?
specifically, i'm looking for a function that would tell me whether or not
there are changes that should be committed to the db before program exit.
thanks-
dan
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: determining if there's a transaction in progress
2002-08-16 13:54 determining if there's a transaction in progress Daniel Kelley <dkelley@otec.com>
@ 2002-08-16 18:11 ` Steve Howe <howe@carcass.dhs.org>
2002-08-17 04:46 ` Re: determining if there's a transaction in progress Warren W. Gay VE3WWG <ve3wwg@cogeco.ca>
0 siblings, 1 reply; 4+ messages in thread
From: Steve Howe @ 2002-08-16 18:11 UTC (permalink / raw)
To: pgsql-interfaces-owner@postgresql.org, Daniel Kelley <dkelley@otec.com>; +Cc: pgsql-interfaces
Hello Daniel,
Friday, August 16, 2002, 10:54:26 AM, you wrote:
DK> hi-
DK> i'm using libpq. is there any way to determine if there is a transaction
DK> is process thru libpq?
There is not.
DK> specifically, i'm looking for a function that would tell me whether or not
DK> there are changes that should be committed to the db before program exit.
If you want to ensure it, I suggest you to *always* start a
transaction and then commit it at the end.
-------------
Best regards,
Steve Howe mailto:howe@carcass.dhs.org
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: determining if there's a transaction in progress
2002-08-16 13:54 determining if there's a transaction in progress Daniel Kelley <dkelley@otec.com>
2002-08-16 18:11 ` Re: determining if there's a transaction in progress Steve Howe <howe@carcass.dhs.org>
@ 2002-08-17 04:46 ` Warren W. Gay VE3WWG <ve3wwg@cogeco.ca>
2002-08-19 08:54 ` Re: determining if there's a transaction in progress Björn Lundin <bjorn.lundin@swipnet.se>
0 siblings, 1 reply; 4+ messages in thread
From: Warren W. Gay VE3WWG @ 2002-08-17 04:46 UTC (permalink / raw)
To: pgsql-interfaces
Steve Howe wrote:
>Hello Daniel,
>Friday, August 16, 2002, 10:54:26 AM, you wrote:
>DK> hi-
>DK> i'm using libpq. is there any way to determine if there is a transaction
>DK> is process thru libpq?
>
>There is not.
>
>
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.
Wish 2:
After performing an INSERT operation, with a column containing a serial
value,
it would be nice to obtain that serial value without having to resort to
a subsequent
SELECT on OID to get at it. INFORMIX (and ORACLE?) make this information
available to the embedded C/C++ clients. The same in libpq would be more
efficient.
Thanks, Warren.
--
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: determining if there's a transaction in progress
2002-08-16 13:54 determining if there's a transaction in progress Daniel Kelley <dkelley@otec.com>
2002-08-16 18:11 ` Re: determining if there's a transaction in progress Steve Howe <howe@carcass.dhs.org>
2002-08-17 04:46 ` Re: determining if there's a transaction in progress Warren W. Gay VE3WWG <ve3wwg@cogeco.ca>
@ 2002-08-19 08:54 ` Björn Lundin <bjorn.lundin@swipnet.se>
0 siblings, 0 replies; 4+ messages in thread
From: Björn Lundin @ 2002-08-19 08:54 UTC (permalink / raw)
To: pgsql-interfaces
Warren W. Gay VE3WWG wrote:
<cut>
> 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.
</cut>
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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-08-19 08:54 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-16 13:54 determining if there's a transaction in progress Daniel Kelley <dkelley@otec.com>
2002-08-16 18:11 ` Steve Howe <howe@carcass.dhs.org>
2002-08-17 04:46 ` Warren W. Gay VE3WWG <ve3wwg@cogeco.ca>
2002-08-19 08:54 ` Björn Lundin <bjorn.lundin@swipnet.se>
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