Re: transactions?

From: Harry Waddell <waddell(at)caravan(dot)com>
To: zdu(at)cs(dot)nmsu(dot)edu
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: transactions?
Date: 2002-09-05 07:43:04
Message-ID: 20020905004304.4da1c968.waddell@caravan.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php


>
> Zhidian Du wrote:
> >
> > I am writing a B/S program. I want to save all the users' inputs, for
> > example, "insert into TABLE value (.....);" in the server side, how can
> > I implement in PHP?
> >
> > also, how can I use transactions to rollback and commit in PHP?
> >

I use these functions to start, stop and abort transactions.
[although most people would find it silly to wrap a single line of code with
another function. I have my reasons.]

Function begin_work($pg){
pg_FreeResult(pg_Exec($pg, "begin work"));
return(TRUE);
}

Function end_work($pg){
pg_FreeResult(pg_Exec($pg, "end work"));
return(TRUE);
}

Function abort_work($pg){
pg_FreeResult(pg_Exec($pg, "abort"));
return(TRUE);
}

where $pg is the database handle from pg_[p]connect().

--
Harry Waddell
Caravan Electronic Publishing

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Areski Belaid 2002-09-06 10:51:27 The Last Optimization
Previous Message Justin Clift 2002-09-05 07:11:29 Re: transactions?