Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id C9D2A9FB209 for ; Tue, 7 Nov 2006 01:59:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 60496-09 for ; Tue, 7 Nov 2006 01:59:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from imf19aec.mail.bellsouth.net (imf19aec.mail.bellsouth.net [205.152.59.67]) by postgresql.org (Postfix) with ESMTP id 85A769FB1E8 for ; Tue, 7 Nov 2006 01:59:35 -0400 (AST) Received: from ibm62aec.bellsouth.net ([65.3.199.201]) by imf20aec.mail.bellsouth.net with ESMTP id <20061107055226.HKNY10729.imf20aec.mail.bellsouth.net@ibm62aec.bellsouth.net> for ; Tue, 7 Nov 2006 00:52:26 -0500 Received: from [192.168.1.2] (really [65.3.199.201]) by ibm62aec.bellsouth.net with ESMTP id <20061107055226.IGWC18248.ibm62aec.bellsouth.net@[192.168.1.2]>; Tue, 7 Nov 2006 00:52:26 -0500 Message-ID: <45503BD3.4090405@brainscraps.com> Date: Tue, 07 Nov 2006 02:54:59 -0500 From: Rick Morris User-Agent: Thunderbird 1.5.0.5 (X11/20060904) MIME-Version: 1.0 To: Robert Treat CC: pgsql-php@postgresql.org Subject: Re: PostgreSQL locking from PHP scripts References: <20061026181147.50048.qmail@web51309.mail.yahoo.com> <454FD71E.6070807@faams.net> <454FE031.2080004@gmail.com> <200611062334.59629.xzilla@users.sourceforge.net> In-Reply-To: <200611062334.59629.xzilla@users.sourceforge.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/16 X-Sequence-Number: 3634 Robert Treat wrote: > On Monday 06 November 2006 20:24, Chris wrote: > >> Herbie McDuck wrote: >> >>> Alan Hodgson wrote: >>> >>>> On Thursday 26 October 2006 11:11, Amal burman >>>> >>>> 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. >>>> >>> So is PHP and 'ANY' database a useless adventure when it goes to >>> developing a robust business and accounting package? >>> >> No, it applies to anything you do in a web browser. >> >> The HTTP protocol is "stateless" which means all resources, connections >> etc are killed at the end of the script. Resources of any type are not >> kept alive at the end of a script. >> >> It's not a php thing or , it's a HTTP >> protocol thing. >> > > In theory you can use prepared transactions to get around this, but I've never > seen anyone fully implement it in PHP. > > How exactly would that work? With PDO Prepare/Execute? Would you prepare a transaction, and then store the PDOStatement object as a session var? Or do you mean this is something that would have to be implemented in PHP internals?