Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 24BB1475A6F for ; Tue, 28 May 2002 12:34:54 -0400 (EDT) Received: from tartarus.telenet-ops.be (tartarus.telenet-ops.be [195.130.132.34]) by postgresql.org (Postfix) with ESMTP id C8C29475A4D for ; Tue, 28 May 2002 12:34:52 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by tartarus.telenet-ops.be (Postfix) with SMTP id E5634DC929 for ; Tue, 28 May 2002 18:34:57 +0200 (CEST) Received: from pandora.be (D57704EB.kabel.telenet.be [213.119.4.235]) by tartarus.telenet-ops.be (Postfix) with ESMTP id BA6B8DC916 for ; Tue, 28 May 2002 18:34:57 +0200 (CEST) Message-ID: <3CF3B04C.89224966@pandora.be> Date: Tue, 28 May 2002 18:29:00 +0200 From: Jurgen Defurne Organization: LinuxIdee X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.16-686 i686) X-Accept-Language: en,nl MIME-Version: 1.0 To: PHP PostgreSQL Subject: Re: using CURSOR with PHP References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200205/101 X-Sequence-Number: 1233 > AFAIK, a CURSOR may be used only inside a single transaction, not a > single session. So it can't be used to 'page' the output of a query, > for example. > > And, also AFAIK, even with pconnect, each connect creates a different > session. Only the (TCP) connection is re-used. I mean, nothing changes > from the PHP script standpoint when you switch from pg_connect() to > pg_pconnect(). > > Quoting the PHP manual: > > " People who aren't thoroughly familiar with the way web servers > work and distribute the load may mistake persistent connects for what > they're not. In particular, they do not give you an ability to open > 'user sessions' on the same SQL link, they do not give you an ability > to build up a transaction efficently, and they don't do a whole lot > of other things. In fact, to be extremely clear about the subject, > persistent connections don't give you any functionality that wasn't > possible with their non-persistent brothers. " > Funny, I am now writing an analysis for myself about this problem. I have experience in databases, and I want to use my experience to build the same kinds of applications that I built on minicomputers. For this I got my requirements together : - I like postgreSQL a lot and includes transactions, this was an easy choice - I wanted to use HTML to build my front-ends (cross-platform!) - Because PHP is neatly integrated with HTML, it is a better choice than Perl or Python However, the only thing that seems to be missing is a layer between CGI and the database. If someone logs in to the system, this layer should return a session key and provide a process which opens a connection to the database and keeps this open until the user logs out. This should be transparent to the application programmer. Since normally all traffic between PHP and postgreSQL goes via the pgsql library, should it not be possible to add an interface which acts as pgsql and handles these sessions and is able to communicate with the real pgsql library, which will then be part of the running program ? In this way it should then be possible to open transactions across CGI invocations and to work with cursors. Does anyone know if something like this exists as Free/OSS ? Regards, Jurgen Defurne