summaryrefslogtreecommitdiff
path: root/src/include/utils/portal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/utils/portal.h')
-rw-r--r--src/include/utils/portal.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 9c09e8eaef..27ef1bf433 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -7,19 +7,14 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: portal.h,v 1.25 2001/01/24 19:43:28 momjian Exp $
+ * $Id: portal.h,v 1.26 2001/02/27 22:07:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Note:
* A portal is an abstraction which represents the execution state of
- * a running query (or a fixed sequence of queries).
- *
- * Note:
- * now that PQ calls can be made from within a backend, a portal
- * may also be used to keep track of the tuples resulting
- * from the execution of a query. In this case, entryIndex
+ * a running query (specifically, a CURSOR).
*/
#ifndef PORTAL_H
#define PORTAL_H
@@ -28,17 +23,19 @@
#include "nodes/memnodes.h"
-typedef struct PortalD *Portal;
+typedef struct PortalData *Portal;
-typedef struct PortalD
+typedef struct PortalData
{
char *name; /* Portal's name */
MemoryContext heap; /* subsidiary memory */
QueryDesc *queryDesc; /* Info about query associated with portal */
TupleDesc attinfo;
- EState *state;
+ EState *state; /* Execution state of query */
+ bool atStart; /* T => fetch backwards is not allowed */
+ bool atEnd; /* T => fetch forwards is not allowed */
void (*cleanup) (Portal); /* Cleanup routine (optional) */
-} PortalD;
+} PortalData;
/*
* PortalIsValid
@@ -46,6 +43,21 @@ typedef struct PortalD
*/
#define PortalIsValid(p) PointerIsValid(p)
+/*
+ * Access macros for Portal ... use these in preference to field access.
+ */
+#define PortalGetQueryDesc(portal) ((portal)->queryDesc)
+#define PortalGetTupleDesc(portal) ((portal)->attinfo)
+#define PortalGetState(portal) ((portal)->state)
+#define PortalGetHeapMemory(portal) ((portal)->heap)
+
+/*
+ * estimate of the maximum number of open portals a user would have,
+ * used in initially sizing the PortalHashTable in EnablePortalManager()
+ */
+#define PORTALS_PER_USER 10
+
+
extern void EnablePortalManager(void);
extern void AtEOXact_portals(void);
extern Portal CreatePortal(char *name);
@@ -54,14 +66,6 @@ extern Portal GetPortalByName(char *name);
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
TupleDesc attinfo, EState *state,
void (*cleanup) (Portal portal));
-extern QueryDesc *PortalGetQueryDesc(Portal portal);
-extern EState *PortalGetState(Portal portal);
-extern MemoryContext PortalGetHeapMemory(Portal portal);
-
-/* estimate of the maximum number of open portals a user would have,
- * used in initially sizing the PortalHashTable in EnablePortalManager()
- */
-#define PORTALS_PER_USER 10
#endif /* PORTAL_H */