Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: first transactions


  • From: Jeff MacDonald <jam(at)zoidtechnologies(dot)com>
  • To: pgsql-php(at)postgresql(dot)org
  • Cc: "A B" <gentosaker(at)gmail(dot)com>
  • Subject: Re: first transactions
  • Date: Wed, 12 Mar 2008 11:29:03 -0500
  • Message-id: <200803121229.04237.jam@zoidtechnologies.com> <text/plain>

On Wednesday 12 March 2008 4:47:33 am A B wrote:
> Hello.
>
> I think I need some help on making it clear on how to use transactions
> in php in a "correct" way.
>
> Lets consider this code/pseudocode
>
[...snipped...]
> So the question is: how do I write the pseudocode parts in php?
> Any other general suggestions on how to make the function more "fool
> proof" is appreciated. :-)

I recommend use of PEAR::MDB2[1] or "PDO"[2]..   typically what I do is run 
the query, rollback if error, continue if not. if you want to be extra 
thorough using MDB2, you can check to make sure the database supports 
transactions, and after a "begin" you can make sure that the transaction has 
been started. my understanding is that PDO has a *very* similar interface to 
MDB2, except that PDO is written in C.

hope that helps some.. if you have more questions post again or email me 
directly.

regards,
jeff

[1] http://pear.php.net/mdb2
[2] http://php.net/pdo
-- 
http://zoidtechnologies.com/
"websites that suck less"



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group