blob: b52314c4633db5d8114dd88e45313f849c5009af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*-------------------------------------------------------------------------
*
* params.h
* Declarations/definitions of stuff needed to handle parameterized plans.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: params.h,v 1.11 1999/07/15 23:03:54 momjian 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.
* and field `paramid' must be == 0.
*
* PARAM_NUM: The parameter has only a numeric identifier,
* i.e. something like `$1', `$2' etc.
* The number is contained in the `parmid' field.
*
* PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED.
* The `paramname' & `paramid' refer to the "NEW" tuple
* `paramname' is the attribute name and `paramid' its
* attribute number.
*
* PARAM_OLD: Same as PARAM_NEW, but in this case we refer to
* the "OLD" tuple.
*
* PARAM_EXEC: Evaluated by executor. Used for subselect...
*
*/
#define PARAM_NAMED 11
#define PARAM_NUM 12
#define PARAM_NEW 13
#define PARAM_OLD 14
#define PARAM_EXEC 15
#define PARAM_INVALID 100
/* ----------------------------------------------------------------
* ParamListInfo
*
* Information needed in order for the executor to handle
* parameterized plans (you know, $.salary, $.name etc. stuff...).
*
* ParamListInfoData contains information needed when substituting a
* Param node with a Const node.
*
* kind : the kind of parameter.
* name : the parameter name (valid if kind == PARAM_NAMED,
* PARAM_NEW or PARAM_OLD)
* id : the parameter id (valid if kind == PARAM_NUM)
* or the attrno (if kind == PARAM_NEW or PARAM_OLD)
* type : PG_TYPE OID of the value
* length : length in bytes of the value
* isnull : true if & only if the value is null (if true then
* the fields 'length' and 'value' are 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. An 'InvalidName' in the name field of such a record
* indicates that this is the last record in the array.
*
* ----------------------------------------------------------------
*/
typedef struct ParamListInfoData
{
int kind;
char *name;
AttrNumber id;
Oid type;
Size length;
bool isnull;
bool byval;
Datum value;
} ParamListInfoData;
typedef ParamListInfoData *ParamListInfo;
typedef struct ParamExecData
{
void *execPlan; /* plan must be executed to get param
* value */
Datum value;
bool isnull;
} ParamExecData;
#endif /* PARAMS_H */
|