pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gavin M. Roy <gmr@ehpg.net>
To: Alan Hodgson <ahodgson@simkin.ca>
Cc: pgsql-php@postgresql.org
Subject: Re: PostgreSQL locking from PHP scripts
Date: Mon, 6 Nov 2006 11:16:51 -0800
Message-ID: <AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net> (raw)
In-Reply-To: <200611061105.29055@hal.medialogik.com>
References: <20061026181147.50048.qmail@web51309.mail.yahoo.com>
	<200611061105.29055@hal.medialogik.com>

Well you can use persistent connections.  Instead of pg_connect use  
pg_pconnect.   I don't know if it will keep the lock or not, I've not  
tested, but it seems like you'd need a pretty elaborate connection  
management setup to make sure you're locking and unlocking the  
records for the right client.

On Nov 6, 2006, at 11:05 AM, Alan Hodgson wrote:

> On Thursday 26 October 2006 11:11, Amal burman  
> <amalburman@yahoo.com> wrote:
>> postgresql database for this project. Here script one
>> (booking.php) tries to setup a lock for update and ask
>> user to fill-up the form. Now when the user fill-up
>> the form and submit it for update, second script
>> (update.php) update the database and releasing the
>> locks.
>
> You can't do this kind of thing in PHP.  PHP resets the database  
> connection
> between scripts.   The script is finished as soon as the page is  
> delivered
> to the client.
>
> Also, web connections are stateless and there is no way to even  
> know what
> web server process or database connection you'll be getting on  
> subsequent
> page views.
>
> -- 
> "It is a besetting vice of democracies to substitute public opinion  
> for
> law." - James Fenimore Cooper
>




view thread (12+ messages)  latest in thread

Message-ID: <AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net>
Permalink:  ../AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net/
Also on:    postgresql.org/message-id/AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net

 · 

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: gmr@ehpg.net, ahodgson@simkin.ca
  Subject: Re: PostgreSQL locking from PHP scripts
  In-Reply-To: <AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net>
  References: <20061026181147.50048.qmail@web51309.mail.yahoo.com> <200611061105.29055@hal.medialogik.com> <AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net>

* 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