1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* portal.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES portal definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-12-05 16:50:39 +01:00
|
|
|
* A portal is an abstraction which represents the execution state of
|
|
|
|
* a running query (specifically, a CURSOR).
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-06-20 22:29:54 +02:00
|
|
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-12-30 23:10:54 +01:00
|
|
|
* $Id: portal.h,v 1.37 2002/12/30 22:10:54 tgl Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef PORTAL_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define PORTAL_H
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "executor/execdesc.h"
|
|
|
|
#include "nodes/memnodes.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
2001-02-27 23:07:34 +01:00
|
|
|
typedef struct PortalData *Portal;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2001-02-27 23:07:34 +01:00
|
|
|
typedef struct PortalData
|
1997-09-07 07:04:48 +02:00
|
|
|
{
|
2000-06-28 05:33:33 +02:00
|
|
|
char *name; /* Portal's name */
|
|
|
|
MemoryContext heap; /* subsidiary memory */
|
|
|
|
QueryDesc *queryDesc; /* Info about query associated with portal */
|
2001-02-27 23:07:34 +01:00
|
|
|
bool atStart; /* T => fetch backwards is not allowed */
|
|
|
|
bool atEnd; /* T => fetch forwards is not allowed */
|
2001-03-22 05:01:46 +01:00
|
|
|
void (*cleanup) (Portal); /* Cleanup routine (optional) */
|
2001-10-25 07:50:21 +02:00
|
|
|
} PortalData;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PortalIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff portal is valid.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define PortalIsValid(p) PointerIsValid(p)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2001-02-27 23:07:34 +01:00
|
|
|
/*
|
|
|
|
* Access macros for Portal ... use these in preference to field access.
|
|
|
|
*/
|
2001-03-22 05:01:46 +01:00
|
|
|
#define PortalGetQueryDesc(portal) ((portal)->queryDesc)
|
2002-09-04 22:31:48 +02:00
|
|
|
#define PortalGetHeapMemory(portal) ((portal)->heap)
|
2001-02-27 23:07:34 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* estimate of the maximum number of open portals a user would have,
|
|
|
|
* used in initially sizing the PortalHashTable in EnablePortalManager()
|
|
|
|
*/
|
2001-05-21 16:22:19 +02:00
|
|
|
#define PORTALS_PER_USER 64
|
2001-02-27 23:07:34 +01:00
|
|
|
|
|
|
|
|
2000-06-28 05:33:33 +02:00
|
|
|
extern void EnablePortalManager(void);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void AtEOXact_portals(void);
|
2002-12-30 23:10:54 +01:00
|
|
|
extern Portal CreatePortal(const char *name);
|
2001-10-05 19:28:13 +02:00
|
|
|
extern void PortalDrop(Portal portal);
|
2002-12-30 23:10:54 +01:00
|
|
|
extern Portal GetPortalByName(const char *name);
|
1998-09-01 06:40:42 +02:00
|
|
|
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
|
2002-12-05 16:50:39 +01:00
|
|
|
void (*cleanup) (Portal portal));
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PORTAL_H */
|