1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* portal.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES portal definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-01-24 23:50:57 +01:00
|
|
|
* $Id: portal.h,v 1.8 1998/01/24 22:50:52 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* A portal is an abstraction which represents the execution state of
|
1996-08-28 03:59:28 +02:00
|
|
|
* a running query (or a fixed sequence of queries). The "blank portal" is
|
|
|
|
* a portal with an InvalidName. This blank portal is in existance except
|
|
|
|
* between calls to BlankPortalAssignName and GetPortalByName(NULL).
|
|
|
|
*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* 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
|
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
|
|
|
|
|
1996-11-04 12:51:27 +01:00
|
|
|
#include <executor/execdesc.h>
|
|
|
|
#include <lib/fstack.h>
|
|
|
|
#include <nodes/memnodes.h>
|
|
|
|
#include <utils/memutils.h>
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct PortalBlockData
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
AllocSetData setData;
|
|
|
|
FixedItemData itemData;
|
1997-09-08 23:56:23 +02:00
|
|
|
} PortalBlockData;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef PortalBlockData *PortalBlock;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct PortalD PortalD;
|
|
|
|
typedef PortalD *Portal;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
struct PortalD
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
char *name; /* XXX PortalName */
|
1997-09-07 07:04:48 +02:00
|
|
|
struct PortalVariableMemory variable;
|
|
|
|
struct PortalHeapMemory heap;
|
1997-09-08 04:41:22 +02:00
|
|
|
QueryDesc *queryDesc;
|
|
|
|
TupleDesc attinfo;
|
|
|
|
EState *state;
|
|
|
|
void (*cleanup) (Portal);
|
1996-08-28 03:59:28 +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
|
|
|
|
|
|
|
/*
|
|
|
|
* Special portals (well, their names anyway)
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define VACPNAME "<vacuum>"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern bool PortalNameIsSpecial(char *pname);
|
|
|
|
extern void AtEOXact_portals(void);
|
|
|
|
extern void EnablePortalManager(bool on);
|
|
|
|
extern Portal GetPortalByName(char *name);
|
|
|
|
extern Portal BlankPortalAssignName(char *name);
|
1998-01-24 23:50:57 +01:00
|
|
|
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
|
1997-09-08 23:56:23 +02:00
|
|
|
TupleDesc attinfo, EState *state,
|
1997-09-07 07:04:48 +02:00
|
|
|
void (*cleanup) (Portal portal));
|
1996-08-28 03:59:28 +02:00
|
|
|
extern QueryDesc *PortalGetQueryDesc(Portal portal);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern EState *PortalGetState(Portal portal);
|
|
|
|
extern Portal CreatePortal(char *name);
|
1997-09-08 23:56:23 +02:00
|
|
|
extern void PortalDestroy(Portal *portalP);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void StartPortalAllocMode(AllocMode mode, Size limit);
|
|
|
|
extern void EndPortalAllocMode(void);
|
1996-08-28 03:59:28 +02:00
|
|
|
extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
|
|
|
|
extern PortalHeapMemory PortalGetHeapMemory(Portal portal);
|
|
|
|
|
|
|
|
/* estimate of the maximum number of open portals a user would have,
|
1997-09-07 07:04:48 +02:00
|
|
|
* used in initially sizing the PortalHashTable in EnablePortalManager()
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define PORTALS_PER_USER 10
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* PORTAL_H */
|