Re: Using Cursors in PHP

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Markus Bertheau <twanger(at)bluetwanger(dot)de>, Andreas Schmitz <a(dot)schmitz(at)cityweb(dot)de>, pgsql-php(at)postgresql(dot)org
Subject: Re: Using Cursors in PHP
Date: 2003-08-08 17:34:43
Message-ID: 200308081734.h78HYhG02971@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

scott.marlowe wrote:
> On 8 Aug 2003, Markus Bertheau wrote:
>
> > ?? ??????, 06.08.2003, ?? 17:51, scott.marlowe ??????????:
> > > On Wed, 6 Aug 2003, Andreas Schmitz wrote:
> > >
> > > >
> > > > Hello *,
> > > >
> > > > I am just wondering if it is possible to use cursors within PHP. I need to
> > > > page query result from a big table and I am looking for a solution to avoid
> > > > scanning the complete table using limit and offset.
> > >
> > > Yes, you can use cursors, no you can't expect them to survive from one
> > > page to the next.
> >
> > What about the new feature in cursors "WITH HOLD"? Don't they survive?
>
> I don't think so. Basically, PHP is supposed to reset the connection if
> it's persistant, and if it isn't persistant, then it's always a new
> connection, which means a cursor shouldn't survive.

Actually, that brings up a problem --- our RESET ALL doesn't close
cursors that are kept open using WITH HOLD.

However, you are right that you can't be sure you will get the same
backend when you connect via a new page, so WITH HOLD doesn't help here.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Lynna Landstreet 2003-08-08 20:30:06 Paging results
Previous Message Rod Taylor 2003-08-08 13:42:11 Re: Using Cursors in PHP