Re: transactions? - Mailing list pgsql-php

From Harry Waddell
Subject Re: transactions?
Date
Msg-id 20020905004304.4da1c968.waddell@caravan.com
Whole thread Raw
In response to Re: transactions?  (Justin Clift <justin@postgresql.org>)
List 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


pgsql-php by date:

Previous
From: Justin Clift
Date:
Subject: Re: transactions?
Next
From: "Areski Belaid"
Date:
Subject: The Last Optimization