From 6261c75014c9948837d9d025493ef18b8f833f70 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 11 Mar 2003 19:40:24 +0000 Subject: Implement SQL92-compatible FIRST, LAST, ABSOLUTE n, RELATIVE n options for FETCH and MOVE. --- src/include/utils/portal.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/include/utils/portal.h') diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h index 21469dd52df..c9ca8547ce2 100644 --- a/src/include/utils/portal.h +++ b/src/include/utils/portal.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: portal.h,v 1.38 2003/03/10 03:53:52 tgl Exp $ + * $Id: portal.h,v 1.39 2003/03/11 19:40:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,10 +27,21 @@ typedef struct PortalData char *name; /* Portal's name */ MemoryContext heap; /* subsidiary memory */ QueryDesc *queryDesc; /* Info about query associated with portal */ - bool backwardOK; /* is fetch backwards allowed at all? */ - bool atStart; /* T => fetch backwards is not allowed now */ - bool atEnd; /* T => fetch forwards is not allowed now */ void (*cleanup) (Portal); /* Cleanup routine (optional) */ + bool backwardOK; /* is fetch backwards allowed? */ + /* + * atStart, atEnd and portalPos indicate the current cursor position. + * portalPos is zero before the first row, N after fetching N'th row of + * query. After we run off the end, portalPos = # of rows in query, and + * atEnd is true. If portalPos overflows, set posOverflow (this causes + * us to stop relying on its value for navigation). Note that atStart + * implies portalPos == 0, but not the reverse (portalPos could have + * overflowed). + */ + bool atStart; + bool atEnd; + bool posOverflow; + long portalPos; } PortalData; /* -- cgit v1.2.3