Re: php with postgres

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Marcus Börger <marcus(dot)boerger(at)post(dot)rwth-aachen(dot)de>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, ivan <iv(at)psycho(dot)pl>, Joe Conway <mail(at)joeconway(dot)com>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: php with postgres
Date: 2003-07-24 21:52:55
Message-ID: 3F205537.3000707@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marcus Börger wrote:
> ATM i have a patch doing the following:
> Connect:
> If PQprotocolVersion() is available and >= 3 PQparameterStatus() is available
> then i check the server version. Else i check the lib version (*).
> If the version to check is >= 7.2 ido one of the following:
> - If one of PQprotocolVersion() and PQtransactionStatus() is unavailable or
> protocol version < 3:
> "BEGIN;COMMIT;RESET ALL;"
>
> - If protocol version >= 3 and transaction status == PQTRANS_IDLE:
> "RESET ALL;"
> - If protocol version >= 3 and transaction status != PQTRANS_IDLE:
> "COMMIT;RESET ALL;"

Shouldn't that be

ROLLBACK; RESET ALL;

and the other one "BEGIN; ROLLBACK; RESET ALL;" ?

I don't want to have the possibly partial transaction from a crashed PHP
script to be committed by default. At least it would be a significant
difference between persistent and non-persistent connections, because we
rollback if we loose the connection.

Jan

>
> Disconnect:
> - When PQprotocolVersion() And PQtransactionStatus() are available then
> i check whether status is PQTRANS_IDLE. If so i do:
> "ROLLBACK;"
> - If the functions are not available in the client libs i do:
> "BEGIN;ROLLBACK;"
>
> Does this sound the correct behavior?
>
> And would "select split_part(version(), ' ', 2);" be too much of a slowdown to
> do the version detection in the startup sequence completely correct?
>
>

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-24 21:57:39 Re: php with postgres
Previous Message Bruce Momjian 2003-07-24 21:52:07 Re: php with postgres