Eneboo - Documentación para desarrolladores
src/libpq/include/nodes/params.h
Ir a la documentación de este archivo.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * params.h
00004  *        Declarations of stuff needed to handle parameterized plans.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * $PostgreSQL: pgsql/src/include/nodes/params.h,v 1.28 2004/12/31 22:03:34 pgsql Exp $
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef PARAMS_H
00015 #define PARAMS_H
00016 
00017 #include "access/attnum.h"
00018 
00019 
00020 /* ----------------
00021  * The following are the possible values for the 'paramkind'
00022  * field of a Param node.
00023  *
00024  * PARAM_NAMED: The parameter has a name, i.e. something
00025  *                              like `$.salary' or `$.foobar'.
00026  *                              In this case field `paramname' must be a valid name.
00027  *
00028  * PARAM_NUM:   The parameter has only a numeric identifier,
00029  *                              i.e. something like `$1', `$2' etc.
00030  *                              The number is contained in the `paramid' field.
00031  *
00032  * PARAM_EXEC:  The parameter is an internal executor parameter.
00033  *                              It has a number contained in the `paramid' field.
00034  *
00035  * PARAM_INVALID should never appear in a Param node; it's used to mark
00036  * the end of a ParamListInfo array.
00037  *
00038  * NOTE: As of PostgreSQL 7.3, named parameters aren't actually used and
00039  * so the code that handles PARAM_NAMED cases is dead code.  We leave it
00040  * in place since it might be resurrected someday.
00041  * ----------------
00042  */
00043 
00044 #define PARAM_NAMED             11
00045 #define PARAM_NUM               12
00046 #define PARAM_EXEC              15
00047 #define PARAM_INVALID   100
00048 
00049 
00050 /* ----------------
00051  *        ParamListInfo
00052  *
00053  *        ParamListInfo entries are used to pass parameters into the executor
00054  *        for parameterized plans.      Each entry in the array defines the value
00055  *        to be substituted for a PARAM_NAMED or PARAM_NUM parameter.
00056  *
00057  *              kind   : the kind of parameter (PARAM_NAMED or PARAM_NUM)
00058  *              name   : the parameter name (valid if kind == PARAM_NAMED)
00059  *              id         : the parameter id (valid if kind == PARAM_NUM)
00060  *              ptype  : the type of the parameter value
00061  *              isnull : true if the value is null (if so 'value' is undefined)
00062  *              value  : the value that has to be substituted in the place
00063  *                               of the parameter.
00064  *
00065  *       ParamListInfo is to be used as an array of ParamListInfoData
00066  *       records.  A dummy record with kind == PARAM_INVALID marks the end
00067  *       of the array.
00068  * ----------------
00069  */
00070 
00071 typedef struct ParamListInfoData
00072 {
00073         int                     kind;
00074         char       *name;
00075         AttrNumber      id;
00076         Oid                     ptype;
00077         bool            isnull;
00078         Datum           value;
00079 } ParamListInfoData;
00080 
00081 typedef ParamListInfoData *ParamListInfo;
00082 
00083 
00084 /* ----------------
00085  *        ParamExecData
00086  *
00087  *        ParamExecData entries are used for executor internal parameters
00088  *        (that is, values being passed into or out of a sub-query).  The
00089  *        paramid of a PARAM_EXEC Param is a (zero-based) index into an
00090  *        array of ParamExecData records, which is referenced through
00091  *        es_param_exec_vals or ecxt_param_exec_vals.
00092  *
00093  *        If execPlan is not NULL, it points to a SubPlanState node that needs
00094  *        to be executed to produce the value.  (This is done so that we can have
00095  *        lazy evaluation of InitPlans: they aren't executed until/unless a
00096  *        result value is needed.)      Otherwise the value is assumed to be valid
00097  *        when needed.
00098  * ----------------
00099  */
00100 
00101 typedef struct ParamExecData
00102 {
00103         void       *execPlan;           /* should be "SubPlanState *" */
00104         Datum           value;
00105         bool            isnull;
00106 } ParamExecData;
00107 
00108 
00109 /* Functions found in src/backend/nodes/params.c */
00110 extern ParamListInfo copyParamList(ParamListInfo from);
00111 extern ParamListInfo lookupParam(ParamListInfo paramList, int thisParamKind,
00112                         const char *thisParamName, AttrNumber thisParamId,
00113                         bool noError);
00114 
00115 #endif   /* PARAMS_H */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'