From: | "Gavin M(dot) Roy" <gmr(at)ehpg(dot)net> |
---|---|
To: | Alan Hodgson <ahodgson(at)simkin(dot)ca> |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: PostgreSQL locking from PHP scripts |
Date: | 2006-11-06 19:16:51 |
Message-ID: | AD96DB84-8FB4-45B9-B71F-99497D34B05B@ehpg.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
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(at)yahoo(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Alan Hodgson | 2006-11-06 19:42:17 | Re: PostgreSQL locking from PHP scripts |
Previous Message | Alan Hodgson | 2006-11-06 19:05:28 | Re: PostgreSQL locking from PHP scripts |