PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
value.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * value.c
4  * implementation of Value nodes
5  *
6  *
7  * Copyright (c) 2003-2017, PostgreSQL Global Development Group
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/nodes/value.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include "nodes/parsenodes.h"
18 
19 /*
20  * makeInteger
21  */
22 Value *
24 {
25  Value *v = makeNode(Value);
26 
27  v->type = T_Integer;
28  v->val.ival = i;
29  return v;
30 }
31 
32 /*
33  * makeFloat
34  *
35  * Caller is responsible for passing a palloc'd string.
36  */
37 Value *
38 makeFloat(char *numericStr)
39 {
40  Value *v = makeNode(Value);
41 
42  v->type = T_Float;
43  v->val.str = numericStr;
44  return v;
45 }
46 
47 /*
48  * makeString
49  *
50  * Caller is responsible for passing a palloc'd string.
51  */
52 Value *
53 makeString(char *str)
54 {
55  Value *v = makeNode(Value);
56 
57  v->type = T_String;
58  v->val.str = str;
59  return v;
60 }
61 
62 /*
63  * makeBitString
64  *
65  * Caller is responsible for passing a palloc'd string.
66  */
67 Value *
68 makeBitString(char *str)
69 {
70  Value *v = makeNode(Value);
71 
72  v->type = T_BitString;
73  v->val.str = str;
74  return v;
75 }
Value * makeString(char *str)
Definition: value.c:53
long ival
Definition: value.h:47
Value * makeInteger(long i)
Definition: value.c:23
union Value::ValUnion val
Value * makeBitString(char *str)
Definition: value.c:68
Value * makeFloat(char *numericStr)
Definition: value.c:38
#define makeNode(_type_)
Definition: nodes.h:557
Definition: value.h:42
Definition: nodes.h:283
char * str
Definition: value.h:48
int i
NodeTag type
Definition: value.h:44