dest.h 2.6 KB
Newer Older
1 2 3
/*-------------------------------------------------------------------------
 *
 * dest.h--
4 5 6
 *		Whenever the backend is submitted a query, the results
 *		have to go someplace - either to the standard output,
 *		to a local portal buffer or to a remote portal buffer.
7
 *
8 9 10
 *	  - stdout is the destination only when we are running a
 *		backend without a postmaster and are returning results
 *		back to the user.
11
 *
12 13 14 15
 *	  - a local portal buffer is the destination when a backend
 *		executes a user-defined function which calls PQexec() or
 *		PQfn().  In this case, the results are collected into a
 *		PortalBuffer which the user's function may diddle with.
16
 *
17 18 19 20 21 22 23 24
 *	  - a remote portal buffer is the destination when we are
 *		running a backend with a frontend and the frontend executes
 *		PQexec() or PQfn().  In this case, the results are sent
 *		to the frontend via the pq_ functions.
 *
 *	  - None is the destination when the system executes
 *		a query internally.  This is not used now but it may be
 *		useful for the parallel optimiser/executor.
25 26 27 28
 *
 *
 * Copyright (c) 1994, Regents of the University of California
 *
29
 * $Id: dest.h,v 1.10 1997/09/08 02:39:16 momjian Exp $
30 31 32 33 34 35
 *
 *-------------------------------------------------------------------------
 */
#ifndef DEST_H
#define DEST_H

36
#include <access/tupdesc.h>
37 38

/* ----------------
39 40
 *		CommandDest is used to allow the results of calling
 *		pg_eval() to go to the right place.
41 42
 * ----------------
 */
43 44 45 46 47 48 49 50 51 52 53 54 55
typedef enum
{
	None,						/* results are discarded */
	Debug,						/* results go to debugging output */
	Local,						/* results go in local portal buffer */
	Remote,						/* results sent to frontend process */
	CopyBegin,					/* results sent to frontend process but
								 * are strings */
	CopyEnd,					/* results sent to frontend process but
								 * are strings */
	RemoteInternal,				/* results sent to frontend process in
								 * internal (binary) form */
	SPI							/* results sent to SPI manager */
56
}			CommandDest;
57 58 59 60 61 62


/* AttrInfo* replaced with TupleDesc, now that TupleDesc also has within it
   the number of attributes

typedef struct AttrInfo {
63 64
	int					numAttr;
	AttributeTupleForm	*attrs;
65 66 67
} AttrInfo;
*/

68 69 70 71 72
extern void (*DestToFunction(CommandDest dest)) ();
extern void EndCommand(char *commandTag, CommandDest dest);
extern void SendCopyBegin(void);
extern void ReceiveCopyBegin(void);
extern void NullCommand(CommandDest dest);
73 74
extern void
BeginCommand(char *pname, int operation, TupleDesc attinfo,
75 76
			 bool isIntoRel, bool isIntoPortal, char *tag,
			 CommandDest dest);
77
extern void UpdateCommandInfo(int operation, Oid lastoid, uint32 tuples);
78

79
#endif							/* DEST_H */