X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A02B75E40C2 for ; Fri, 6 Aug 2004 07:02:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17144-01 for ; Fri, 6 Aug 2004 10:02:21 +0000 (GMT) Received: from Morgoth.esiway.net (Morgoth.ESIWAY.NET [193.194.16.157]) by svr1.postgresql.org (Postfix) with ESMTP id 4CFA35E40BF for ; Fri, 6 Aug 2004 07:02:16 -0300 (ADT) Received: from Megathlon.ESI (Ghost.esi.it [193.194.16.225]) by Morgoth.esiway.net (8.12.10/8.12.10) with ESMTP id i76A2EO0019254 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Fri, 6 Aug 2004 12:02:15 +0200 Received: from [10.10.10.13] (Frodo.ESI [10.10.10.13]) (user=marco mech=CRAM-MD5 bits=0) by Megathlon.ESI (8.12.10/8.12.10) with ESMTP id i76A2DQc013278 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Fri, 6 Aug 2004 12:02:14 +0200 Message-ID: <41135725.70304@esi.it> Date: Fri, 06 Aug 2004 12:02:13 +0200 From: Marco Colombo User-Agent: Mozilla Thunderbird 0.6 (X11/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: reiner peterke Cc: pgsql-php@postgresql.org Subject: Re: [0.2] getting transactions to work References: <018301c47648$db231990$0301a8c0@Mesa.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/8 X-Sequence-Number: 2896 reiner peterke wrote: > well i've read about this thing called persistent connection, > i think it is supposed to exist in mysql also. the idea sound like what > i want. i've tried it but i didn't get any different results. but then > i'm not convinced i did it right either. You have to face the fact that HTTP is _stateless_. Any common HTTP server will obey to that, thus destroying any resource related to the request it just served, _or_ making it appear as if it was destroyed. You really need to think hard of the implications here. Persistent connections are no exception: they are just a way to boost perfermance, but there should be no visible difference at application level. That is, you should be able to change pg_connect()'s with pg_pconnect()'s (and vice versa) without changing anything else in your PHP scripts. Persistent connections add _no_ extra functionality to your PHP application. Transactions exist at SQL session level. A "session" is inherently statefull, and will be destroyed (or made appear as destroyed) at the end for each HTTP request, because it _has_ to appear stateless. The request for the 'next' page may be served by a different process, or a even a different host, so no state can be shared. There's simply no way you can control this. Sessions/cookies alone won't let you use transactions, they'll just emulate them. You can delay the transaction till the final page, but it's just not the same. Of course, you can write your own HTTP server (there are simple-to-use Perl or Python modules to do that) that deliberately fails to adhere to the HTTP model, and keeps some state. If you control all the environment, that may even work. One possible solution is to write proxy application (a server), which talks on one side to the SQL db and on the other to the PHP frontend. .TM. -- ____/ ____/ / / / / Marco Colombo ___/ ___ / / Technical Manager / / / ESI s.r.l. _____/ _____/ _/ Colombo@ESI.it