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 D16A1D1C91F for ; Fri, 8 Aug 2003 17:35:34 +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 62977-01 for ; Fri, 8 Aug 2003 14:34:07 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id D378FD1C4DB for ; Fri, 8 Aug 2003 14:35:22 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h78HYhG02971; Fri, 8 Aug 2003 13:34:43 -0400 (EDT) From: Bruce Momjian Message-Id: <200308081734.h78HYhG02971@candle.pha.pa.us> Subject: Re: Using Cursors in PHP In-Reply-To: To: "scott.marlowe" Date: Fri, 8 Aug 2003 13:34:43 -0400 (EDT) Cc: Markus Bertheau , Andreas Schmitz , pgsql-php@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/29 X-Sequence-Number: 2206 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@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073