Re: using CURSOR with PHP - Mailing list pgsql-php

From Jurgen Defurne
Subject Re: using CURSOR with PHP
Date
Msg-id 3CF3B04C.89224966@pandora.be
Whole thread Raw
In response to Re: using CURSOR with PHP  (Marco Colombo <marco@esi.it>)
Responses Re: using CURSOR with PHP  (Andrew McMillan <andrew@catalyst.net.nz>)
List pgsql-php
> 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

pgsql-php by date:

Previous
From: Marco Colombo
Date:
Subject: Re: using CURSOR with PHP
Next
From: Eckhard Hoeffner
Date:
Subject: Re: using CURSOR with PHP