mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-13 23:49:34 +02:00
4baaf863ec
Backpatch certain files through 9.0
76 lines
1.1 KiB
C
76 lines
1.1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* value.c
|
|
* implementation of Value nodes
|
|
*
|
|
*
|
|
* Copyright (c) 2003-2015, PostgreSQL Global Development Group
|
|
*
|
|
*
|
|
* IDENTIFICATION
|
|
* src/backend/nodes/value.c
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#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;
|
|
}
|