postgresql/src/include/nodes/params.h
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00

115 lines
3.6 KiB
C

/*-------------------------------------------------------------------------
*
* params.h
* Declarations of stuff needed to handle parameterized plans.
*
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/params.h,v 1.28 2004/12/31 22:03:34 pgsql Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PARAMS_H
#define PARAMS_H
#include "access/attnum.h"
/* ----------------
* The following are the possible values for the 'paramkind'
* field of a Param node.
*
* PARAM_NAMED: The parameter has a name, i.e. something
* like `$.salary' or `$.foobar'.
* In this case field `paramname' must be a valid name.
*
* PARAM_NUM: The parameter has only a numeric identifier,
* i.e. something like `$1', `$2' etc.
* The number is contained in the `paramid' field.
*
* PARAM_EXEC: The parameter is an internal executor parameter.
* It has a number contained in the `paramid' field.
*
* PARAM_INVALID should never appear in a Param node; it's used to mark
* the end of a ParamListInfo array.
*
* NOTE: As of PostgreSQL 7.3, named parameters aren't actually used and
* so the code that handles PARAM_NAMED cases is dead code. We leave it
* in place since it might be resurrected someday.
* ----------------
*/
#define PARAM_NAMED 11
#define PARAM_NUM 12
#define PARAM_EXEC 15
#define PARAM_INVALID 100
/* ----------------
* ParamListInfo
*
* ParamListInfo entries are used to pass parameters into the executor
* for parameterized plans. Each entry in the array defines the value
* to be substituted for a PARAM_NAMED or PARAM_NUM parameter.
*
* kind : the kind of parameter (PARAM_NAMED or PARAM_NUM)
* name : the parameter name (valid if kind == PARAM_NAMED)
* id : the parameter id (valid if kind == PARAM_NUM)
* ptype : the type of the parameter value
* isnull : true if the value is null (if so 'value' is undefined)
* value : the value that has to be substituted in the place
* of the parameter.
*
* ParamListInfo is to be used as an array of ParamListInfoData
* records. A dummy record with kind == PARAM_INVALID marks the end
* of the array.
* ----------------
*/
typedef struct ParamListInfoData
{
int kind;
char *name;
AttrNumber id;
Oid ptype;
bool isnull;
Datum value;
} ParamListInfoData;
typedef ParamListInfoData *ParamListInfo;
/* ----------------
* ParamExecData
*
* ParamExecData entries are used for executor internal parameters
* (that is, values being passed into or out of a sub-query). The
* paramid of a PARAM_EXEC Param is a (zero-based) index into an
* array of ParamExecData records, which is referenced through
* es_param_exec_vals or ecxt_param_exec_vals.
*
* If execPlan is not NULL, it points to a SubPlanState node that needs
* to be executed to produce the value. (This is done so that we can have
* lazy evaluation of InitPlans: they aren't executed until/unless a
* result value is needed.) Otherwise the value is assumed to be valid
* when needed.
* ----------------
*/
typedef struct ParamExecData
{
void *execPlan; /* should be "SubPlanState *" */
Datum value;
bool isnull;
} ParamExecData;
/* Functions found in src/backend/nodes/params.c */
extern ParamListInfo copyParamList(ParamListInfo from);
extern ParamListInfo lookupParam(ParamListInfo paramList, int thisParamKind,
const char *thisParamName, AttrNumber thisParamId,
bool noError);
#endif /* PARAMS_H */