1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* params.h
|
2002-11-25 22:29:42 +01:00
|
|
|
* Declarations of stuff needed to handle parameterized plans.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2004-08-29 06:13:13 +02:00
|
|
|
* Portions Copyright (c) 1996-2004, 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
|
|
|
*
|
2004-08-29 06:13:13 +02:00
|
|
|
* $PostgreSQL: pgsql/src/include/nodes/params.h,v 1.26 2004/08/29 04:13:07 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PARAMS_H
|
|
|
|
#define PARAMS_H
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "access/attnum.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2002-11-25 22:29:42 +01:00
|
|
|
|
|
|
|
/* ----------------
|
1996-08-28 03:59:28 +02:00
|
|
|
* The following are the possible values for the 'paramkind'
|
|
|
|
* field of a Param node.
|
1997-09-07 07:04:48 +02:00
|
|
|
*
|
1996-08-28 03:59:28 +02:00
|
|
|
* PARAM_NAMED: The parameter has a name, i.e. something
|
1997-09-07 07:04:48 +02:00
|
|
|
* like `$.salary' or `$.foobar'.
|
2002-11-25 22:29:42 +01:00
|
|
|
* In this case field `paramname' must be a valid name.
|
1997-09-07 07:04:48 +02:00
|
|
|
*
|
|
|
|
* PARAM_NUM: The parameter has only a numeric identifier,
|
|
|
|
* i.e. something like `$1', `$2' etc.
|
2002-11-25 22:29:42 +01:00
|
|
|
* The number is contained in the `paramid' field.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-11-25 22:29:42 +01:00
|
|
|
* PARAM_EXEC: The parameter is an internal executor parameter.
|
|
|
|
* It has a number contained in the `paramid' field.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-11-25 22:29:42 +01:00
|
|
|
* PARAM_INVALID should never appear in a Param node; it's used to mark
|
|
|
|
* the end of a ParamListInfo array.
|
1998-02-13 04:45:29 +01:00
|
|
|
*
|
2002-11-25 22:29:42 +01:00
|
|
|
* 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.
|
|
|
|
* ----------------
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define PARAM_NAMED 11
|
|
|
|
#define PARAM_NUM 12
|
1998-02-26 05:46:47 +01:00
|
|
|
#define PARAM_EXEC 15
|
1997-09-07 07:04:48 +02:00
|
|
|
#define PARAM_INVALID 100
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
2002-11-25 22:29:42 +01:00
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* ParamListInfo
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-11-25 22:29:42 +01:00
|
|
|
* ParamListInfo entries are used to pass parameters into the executor
|
2003-08-04 02:43:34 +02:00
|
|
|
* for parameterized plans. Each entry in the array defines the value
|
2002-11-25 22:29:42 +01:00
|
|
|
* to be substituted for a PARAM_NAMED or PARAM_NUM parameter.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2002-11-25 22:29:42 +01:00
|
|
|
* kind : the kind of parameter (PARAM_NAMED or PARAM_NUM)
|
|
|
|
* name : the parameter name (valid if kind == PARAM_NAMED)
|
2004-08-02 03:30:51 +02:00
|
|
|
* id : the parameter id (valid if kind == PARAM_NUM)
|
|
|
|
* ptype : the type of the parameter value
|
2002-11-25 22:29:42 +01:00
|
|
|
* isnull : true if the value is null (if so 'value' is undefined)
|
1997-09-07 07:04:48 +02:00
|
|
|
* value : the value that has to be substituted in the place
|
|
|
|
* of the parameter.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* ParamListInfo is to be used as an array of ParamListInfoData
|
2002-11-25 22:29:42 +01:00
|
|
|
* records. A dummy record with kind == PARAM_INVALID marks the end
|
|
|
|
* of the array.
|
|
|
|
* ----------------
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct ParamListInfoData
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
int kind;
|
|
|
|
char *name;
|
|
|
|
AttrNumber id;
|
2004-08-02 03:30:51 +02:00
|
|
|
Oid ptype;
|
1997-09-08 04:41:22 +02:00
|
|
|
bool isnull;
|
|
|
|
Datum value;
|
1997-09-08 23:56:23 +02:00
|
|
|
} ParamListInfoData;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
typedef ParamListInfoData *ParamListInfo;
|
|
|
|
|
2002-11-25 22:29:42 +01:00
|
|
|
|
|
|
|
/* ----------------
|
|
|
|
* 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.
|
|
|
|
*
|
2002-12-14 01:17:59 +01:00
|
|
|
* If execPlan is not NULL, it points to a SubPlanState node that needs
|
2003-08-04 02:43:34 +02:00
|
|
|
* to be executed to produce the value. (This is done so that we can have
|
2002-11-25 22:29:42 +01:00
|
|
|
* lazy evaluation of InitPlans: they aren't executed until/unless a
|
2003-08-04 02:43:34 +02:00
|
|
|
* result value is needed.) Otherwise the value is assumed to be valid
|
2002-11-25 22:29:42 +01:00
|
|
|
* when needed.
|
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
1998-02-13 04:45:29 +01:00
|
|
|
typedef struct ParamExecData
|
|
|
|
{
|
2002-12-14 01:17:59 +01:00
|
|
|
void *execPlan; /* should be "SubPlanState *" */
|
1998-02-13 04:45:29 +01:00
|
|
|
Datum value;
|
|
|
|
bool isnull;
|
|
|
|
} ParamExecData;
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2004-08-02 03:30:51 +02:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PARAMS_H */
|