Re: PostgreSQL locking from PHP scripts - Mailing list pgsql-php

From Herbie McDuck
Subject Re: PostgreSQL locking from PHP scripts
Date
Msg-id 45501DE3.9050500@faams.net
Whole thread Raw
In response to Re: PostgreSQL locking from PHP scripts  (Charley Tiggs <lists@tiggs.net>)
List pgsql-php
Charley Tiggs wrote:
> Herbie McDuck wrote:
>>> 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.
>> So is PHP and 'ANY' database a useless adventure when it goes to
>> developing a robust business and accounting package?
>
> Not at all.  It just means that you'll have to create your own "state"
> logic using sessions.  For instance, create a column within the
> necessary table that you can check to see whether or not some other
> process/user is using the record in question and then build the
> necessary logic around that to enable/disable access to the records.
>
> This is something that isn't specific to PHP.  You'll encounter the
> same issues with any other middleware language that uses a web browser
> as it's primary means of interaction.  HTTP just doesn't keep track of
> the state of your application.  It's up to you as the developer to
> handle that.
>
> Charley
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
>                http://www.postgresql.org/about/donate
>
>
Hmmm..Yes I can see two columns in a record. The 'WHO' and some pending
transaction ID that the calling session that locked the record knows
about so that the update session can find the relevant and specific
record to transact with.

As mentioned, I've done something similar in another language. When you
have ten people trying to sell low sulfur diesel fuel at the same moment
in time, record contention can become dicey at best.

--Hal.


pgsql-php by date:

Previous
From: Robert Treat
Date:
Subject: Re: PostgreSQL locking from PHP scripts
Next
From: Rick Morris
Date:
Subject: Re: PostgreSQL locking from PHP scripts