Re: How to manipulate a cursor returned by a PL/pgSQL in a PHP

From: "Andrew J(dot) Kopciuch" <akopciuch(at)olympusproject(dot)org>
To: Rod Taylor <rbt(at)rbt(dot)ca>
Cc: sebastien(dot)baudry(at)baudry-engineering(dot)com, Sebastien BAUDRY <sbaudry(at)yahoo(dot)com>, pgsql-php(at)postgresql(dot)org
Subject: Re: How to manipulate a cursor returned by a PL/pgSQL in a PHP
Date: 2003-10-05 15:21:47
Message-ID: 200310050921.47505.akopciuch@olympusproject.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Sunday 05 October 2003 06:22, Rod Taylor wrote:
> On Sun, 2003-10-05 at 04:38, Andrew J. Kopciuch wrote:
> > On Sunday 05 October 2003 01:32, Sebastien BAUDRY wrote:
> > > Hi.
> > > My function returns a cursor and I don't know how to
> > > fetch the cursor in my PHP script.
> > > Anybody could help me?
> >
> > PHP does not directly support cursors under PostgreSQL. :-(
>
> Huh? Cursors in PostgreSQL are accessible via the standard query
> interface within PHP.
>
> It's 2 queries, one to create the cursor, one to request the number of
> tuples. PHP does not need any special logic to handle this.
>
> pg_query('DECLARE thecursor CURSOR FOR ....')
>
> pg_query('FETCH ...');
>
> The fetch will act just like a select in regards to returned data.

Yes. I should have elaborated a bit more.

I think this is in reference to his earlier post mentioning a REF CURSOR from
a stored procedure. There is no support for binding a PHP var to a cursor
like the Oracle functions offer. (OCINewCursor, OCIFreeCursor)

You can always manage things directly with the query interface. I think he
wants to manage things with the PHP interface. And you can't with the
PostgreSQL functions provided. AFAIK.

That's all I was saying,

cheers,

Andy

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Sebastien Baudry 2003-10-06 08:17:51 Re: How to manipulate a cursor returned by a PL/pgSQL in a PHP
Previous Message Rod Taylor 2003-10-05 12:22:02 Re: How to manipulate a cursor returned by a PL/pgSQL in a PHP