about transactions in Postgresql
| From: | Raphael Hamzagic de Carvalho | Date: | Fri, 09 May 2003 16:03:15 +0000 |
| Subject: | about transactions in Postgresql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27619@lists.php.net to get a copy of this message | ||
Hi,
I dont know if transactions decrease considerable performance in register
systems.
For Example:
PHP algoritm:
$query = "Begin;";
pg_query($connId, $query);
$query = "insert into member values('Jim Jones', '21', 'passw',
'jim@bfr.com');";
pg_query($connId, $query);
if ( mail(jim@bfr.com, "Welcome", "", ""))
{
$query = "COMMIT;";
pg_query($connId, $query);
}
else
{
$query = "ROLLBACK;";
pg_query($connId, $query);
}
I dont know if this is a good technique, but my point is:
If the email that is sent to the user being inserted on database fails, I
want to rollback transaction and dont register that user....
Thanks in advance!
Rapha