1/*--------------------------------------------------------------------
2 * Symbols referenced in this file:
3 * - makeInteger
4 * - makeString
5 * - makeFloat
6 *--------------------------------------------------------------------
7 */
8
9/*-------------------------------------------------------------------------
10 *
11 * value.c
12 * implementation of PGValue nodes
13 *
14 *
15 * Copyright (c) 2003-2017, PostgreSQL Global Development PGGroup
16 *
17 *
18 * IDENTIFICATION
19 * src/backend/nodes/value.c
20 *
21 *-------------------------------------------------------------------------
22 */
23#include "pg_functions.hpp"
24
25#include "nodes/parsenodes.hpp"
26#include <string>
27#include <cstring>
28
29namespace duckdb_libpgquery {
30
31/*
32 * makeInteger
33 */
34PGValue *makeInteger(long i) {
35 PGValue *v = makeNode(PGValue);
36
37 v->type = T_PGInteger;
38 v->val.ival = i;
39 return v;
40}
41
42/*
43 * makeFloat
44 *
45 * Caller is responsible for passing a palloc'd string.
46 */
47PGValue *makeFloat(char *numericStr) {
48 PGValue *v = makeNode(PGValue);
49
50 v->type = T_PGFloat;
51 v->val.str = numericStr;
52 return v;
53}
54
55/*
56 * makeString
57 *
58 * Caller is responsible for passing a palloc'd string.
59 */
60PGValue *makeString(const char *str) {
61 PGValue *v = makeNode(PGValue);
62
63 v->type = T_PGString;
64 v->val.str = (char *)str;
65 return v;
66}
67
68/*
69 * makeBitString
70 *
71 * Caller is responsible for passing a palloc'd string.
72 */
73
74}