From: | mikie <mikie(dot)pl(at)gmail(dot)com> |
---|---|
To: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: transactions from PHP - double COMMIT required? |
Date: | 2007-03-01 12:45:08 |
Message-ID: | ca35ce500703010445n67ca6714id0b10b393859f8e0@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
2007/3/1, David Legault <legault(dot)david(at)gmail(dot)com>:
> If you are using PHP5 (and the PDO PGSQL) I would suggest you use exceptions to trap the error
>
> try {
>
> $db->beginTransaction();
>
> // other queries here, if one fails, an exception is thrown
>
> $db->commit();
> }
> catch (Exception $e) {
>
> // do whatever with error
> $db->rollback();
>
> }
Yes, that is nice way to work with databases, but I am on PHP4 and I
am not using the PDO.
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?
--
Mike
From | Date | Subject | |
---|---|---|---|
Next Message | Martin Marques | 2007-03-01 12:47:22 | Re: transactions from PHP - double COMMIT required? |
Previous Message | David Legault | 2007-03-01 12:18:54 | Re: transactions from PHP - double COMMIT required? |