pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff MacDonald <jam@zoidtechnologies.com>
To: pgsql-php@postgresql.org
Cc: A B <gentosaker@gmail.com>
Subject: Re: first transactions
Date: Wed, 12 Mar 2008 11:29:03 -0500
Message-ID: <200803121229.04237.jam@zoidtechnologies.com> (raw)
In-Reply-To: <dbbf25900803120147l6900fc28rac8b5789f95b4a27@mail.gmail.com>
References: <dbbf25900803120147l6900fc28rac8b5789f95b4a27@mail.gmail.com>

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"



view thread (2+ messages)

Message-ID: <200803121229.04237.jam@zoidtechnologies.com>
Permalink:  ../200803121229.04237.jam@zoidtechnologies.com/
Also on:    postgresql.org/message-id/200803121229.04237.jam@zoidtechnologies.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: jam@zoidtechnologies.com, gentosaker@gmail.com
  Subject: Re: first transactions
  In-Reply-To: <200803121229.04237.jam@zoidtechnologies.com>
  References: <dbbf25900803120147l6900fc28rac8b5789f95b4a27@mail.gmail.com> <200803121229.04237.jam@zoidtechnologies.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox