Header And Logo

| The world's most advanced open source database.

Data Structures | Defines | Typedefs | Functions

params.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ParamExternData
struct  ParamListInfoData
struct  ParamExecData


#define PARAM_FLAG_CONST   0x0001


typedef struct ParamExternData ParamExternData
typedef struct ParamListInfoDataParamListInfo
typedef void(* ParamFetchHook )(ParamListInfo params, int paramid)
typedef void(* ParserSetupHook )(struct ParseState *pstate, void *arg)
typedef struct ParamListInfoData ParamListInfoData
typedef struct ParamExecData ParamExecData


ParamListInfo copyParamList (ParamListInfo from)

Define Documentation

#define PARAM_FLAG_CONST   0x0001

Definition at line 51 of file params.h.

Referenced by eval_const_expressions_mutator().

Typedef Documentation

typedef struct ParamExecData ParamExecData
typedef void(* ParamFetchHook)(ParamListInfo params, int paramid)

Definition at line 63 of file params.h.

Definition at line 61 of file params.h.

typedef void(* ParserSetupHook)(struct ParseState *pstate, void *arg)

Definition at line 65 of file params.h.

Function Documentation

ParamListInfo copyParamList ( ParamListInfo  from  ) 

Definition at line 34 of file params.c.

References datumCopy(), get_typlenbyval(), i, ParamExternData::isnull, NULL, ParamListInfoData::numParams, OidIsValid, palloc(), ParamListInfoData::paramFetch, ParamListInfoData::paramFetchArg, ParamListInfoData::params, ParamListInfoData::parserSetup, ParamListInfoData::parserSetupArg, ParamExternData::ptype, and ParamExternData::value.

Referenced by PerformCursorOpen(), and SPI_cursor_open_internal().

    ParamListInfo retval;
    Size        size;
    int         i;

    if (from == NULL || from->numParams <= 0)
        return NULL;

    /* sizeof(ParamListInfoData) includes the first array element */
    size = sizeof(ParamListInfoData) +
        (from->numParams - 1) * sizeof(ParamExternData);

    retval = (ParamListInfo) palloc(size);
    retval->paramFetch = NULL;
    retval->paramFetchArg = NULL;
    retval->parserSetup = NULL;
    retval->parserSetupArg = NULL;
    retval->numParams = from->numParams;

    for (i = 0; i < from->numParams; i++)
        ParamExternData *oprm = &from->params[i];
        ParamExternData *nprm = &retval->params[i];
        int16       typLen;
        bool        typByVal;

        /* give hook a chance in case parameter is dynamic */
        if (!OidIsValid(oprm->ptype) && from->paramFetch != NULL)
            (*from->paramFetch) (from, i + 1);

        /* flat-copy the parameter info */
        *nprm = *oprm;

        /* need datumCopy in case it's a pass-by-reference datatype */
        if (nprm->isnull || !OidIsValid(nprm->ptype))
        get_typlenbyval(nprm->ptype, &typLen, &typByVal);
        nprm->value = datumCopy(nprm->value, typByVal, typLen);

    return retval;