Re: using CURSOR with PHP

From: Jurgen Defurne <jurgen(dot)defurne(at)pandora(dot)be>
To: PHP PostgreSQL <pgsql-php(at)postgresql(dot)org>
Subject: Re: using CURSOR with PHP
Date: 2002-05-28 16:29:00
Message-ID: 3CF3B04C.89224966@pandora.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Eckhard Hoeffner 2002-05-28 16:47:17 Re: using CURSOR with PHP
Previous Message Marco Colombo 2002-05-28 16:26:18 Re: using CURSOR with PHP