Re: transactions from PHP - double COMMIT required? - Mailing list pgsql-php

From mikie
Subject Re: transactions from PHP - double COMMIT required?
Date
Msg-id ca35ce500703010842v193a90cavdf8052330482ee9a@mail.gmail.com
Whole thread Raw
In response to Re: transactions from PHP - double COMMIT required?  (Martin Marques <martin@bugs.unl.edu.ar>)
Responses Re: transactions from PHP - double COMMIT required?
Re: transactions from PHP - double COMMIT required?
List pgsql-php
2007/3/1, Martin Marques <martin@bugs.unl.edu.ar>:
> mikie wrote:
> >> > But getting back to my problem - perhaps there is something I
> >> > misunderstood: is it the client application responsibility to check if
> >> > the transaction failed or succeeded and issue COMMIT or ROLLBACK
> >> > accordingly (how do I close the transaction block in that case)?
> >> > Or is it the database server that is suppose to check if transaction
> >> > succeded and perform the query, or ROLLBACK if anything went wrong?
> >>
> >> PG will rollback all transactions that have an error in some part, as it
> >> can't commit the transaction as a whole.
> >
> > OK, so my way of programming seems correct.
> > Then why do I have to send another COMMIT after failed transaction to
> > continue with next queries in the same php script ?
>
> I may not have gotten your question right, but with one commit (or end)
> is enough. Transaction gets closed (commited or rolled back), and you
> can start a new transaction with BEGIN.

Thats exactly what I was thinking, too. But PHP does things in some
other way, I guess.
I am sending an entire sql transaction block to the PHP pg_query
command, so it starts with BEGIN and ends with COMMIT. Then I still
have to execute another pg_query with "commit;" only - thats why I am
asking here if maybe someone know what the problem is.

pgsql-php by date:

Previous
From: Martin Marques
Date:
Subject: Re: transactions from PHP - double COMMIT required?
Next
From: Robert Treat
Date:
Subject: New PHPUG starting in Columbia, MD