2004-01-07 19:43:36 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* value.c
|
|
|
|
* implementation of Value nodes
|
|
|
|
*
|
|
|
|
*
|
2010-01-02 17:58:17 +01:00
|
|
|
* Copyright (c) 2003-2010, PostgreSQL Global Development Group
|
2004-01-07 19:43:36 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2010-01-02 17:58:17 +01:00
|
|
|
* $PostgreSQL: pgsql/src/backend/nodes/value.c,v 1.7 2010/01/02 16:57:46 momjian Exp $
|
2004-01-07 19:43:36 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include "nodes/parsenodes.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* makeInteger
|
|
|
|
*/
|
|
|
|
Value *
|
|
|
|
makeInteger(long i)
|
|
|
|
{
|
|
|
|
Value *v = makeNode(Value);
|
|
|
|
|
|
|
|
v->type = T_Integer;
|
|
|
|
v->val.ival = i;
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* makeFloat
|
|
|
|
*
|
|
|
|
* Caller is responsible for passing a palloc'd string.
|
|
|
|
*/
|
|
|
|
Value *
|
|
|
|
makeFloat(char *numericStr)
|
|
|
|
{
|
|
|
|
Value *v = makeNode(Value);
|
|
|
|
|
|
|
|
v->type = T_Float;
|
|
|
|
v->val.str = numericStr;
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* makeString
|
|
|
|
*
|
|
|
|
* Caller is responsible for passing a palloc'd string.
|
|
|
|
*/
|
|
|
|
Value *
|
|
|
|
makeString(char *str)
|
|
|
|
{
|
|
|
|
Value *v = makeNode(Value);
|
|
|
|
|
|
|
|
v->type = T_String;
|
|
|
|
v->val.str = str;
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* makeBitString
|
|
|
|
*
|
|
|
|
* Caller is responsible for passing a palloc'd string.
|
|
|
|
*/
|
|
|
|
Value *
|
|
|
|
makeBitString(char *str)
|
|
|
|
{
|
|
|
|
Value *v = makeNode(Value);
|
|
|
|
|
|
|
|
v->type = T_BitString;
|
|
|
|
v->val.str = str;
|
|
|
|
return v;
|
|
|
|
}
|