Re: Practical Cursors

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: "Command Prompt, Inc(dot)" <pgsql-general(at)commandprompt(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Practical Cursors
Date: 2001-09-17 21:56:42
Message-ID: 021b01c13fc3$a3a29b80$6cdc10ac@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> However, using something like PHP will not allow this because HTTP is
> stateless and PostgreSQL will not know from one transaction to the next
> that the results of the connection are related.
>
> Is this truly the case, or is there a way for PostgreSQL to remember the
> connection identifier so that the next time a PHP connection is made with
> the same identifier a transaction can be completed?
>
> Sincerely,
>
> Joshua Drake
>

I have actually been thinking recently about just this question. I looked
through the source for the PHP pgsql extension and it is clear that no
cursor is used. There is, however, the ability to open a persistent
connection to PostgreSQL from PHP. I think it would be possible to create a
persistent resource identifier to a cursor in a similar manner, and "reuse"
the cursor across multiple HTTP requests.

The downside I can see is that PHP would have no way to know when it could
garbage-collect the allocated resource. So while it could be done, what
would happen when the user closes their browser with your cursor still open?

-- Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2001-09-17 21:57:16 Re: Left Joins
Previous Message Brett Schwarz 2001-09-17 21:55:07 RRules using existing data