X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CF13ED1B4FC for ; Sun, 5 Oct 2003 15:25:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 59166-07 for ; Sun, 5 Oct 2003 12:24:28 -0300 (ADT) Received: from mail.nucleus.com (mail.nucleus.com [207.34.93.23]) by svr1.postgresql.org (Postfix) with ESMTP id A24CAD1B585 for ; Sun, 5 Oct 2003 12:24:01 -0300 (ADT) Received: from dsl-mtryl-209-5-169-111-cgy.nucleus.com (unverified [209.5.169.111]) by mail.nucleus.com (Vircom SMTPRS 2.1.268) with ESMTP id ; Sun, 5 Oct 2003 09:23:49 -0600 From: "Andrew J. Kopciuch" Reply-To: akopciuch@olympusproject.org Organization: Olympus Open Source Project To: Rod Taylor Subject: Re: How to manipulate a cursor returned by a PL/pgSQL in a PHP Date: Sun, 5 Oct 2003 09:21:47 -0600 User-Agent: KMail/1.5 Cc: sebastien.baudry@baudry-engineering.com, Sebastien BAUDRY , pgsql-php@postgresql.org References: <20031005073201.91481.qmail@web13807.mail.yahoo.com> <200310050238.37577.akopciuch@olympusproject.org> <1065356520.23288.144.camel@jester> In-Reply-To: <1065356520.23288.144.camel@jester> X-MailKey: Flyers winning makes BDDF happy MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310050921.47505.akopciuch@olympusproject.org> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/11 X-Sequence-Number: 2372 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