Re: about transactions in Postgresql

From: Date: Fri, 09 May 2003 16:22:47 +0000
Subject: Re: about transactions in Postgresql
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27621@lists.php.net to get a copy of this message
Why don't you insert the record flaged in same way, in order to verify the email. If that fails, you delete the record, otherwise, you update it, meaning that everything is ok. Luis Sousa Raphael Hamzagic de Carvalho wrote:
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
-- Luis Sousa Especialista de Informática Gabinete de Gestão de Informação, ext: 7837 Campus de Gambelas Universidade do Algarve, tel: 289800900

« previous php.db (#27621) next »