1 | /*------------------------------------------------------------------------- |
2 | * |
3 | * value.c |
4 | * implementation of Value nodes |
5 | * |
6 | * |
7 | * Copyright (c) 2003-2019, 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 * |
23 | makeInteger(int i) |
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 | } |
76 | |