| 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 | |
| 27 | /* |
| 28 | * makeInteger |
| 29 | */ |
| 30 | PGValue * |
| 31 | makeInteger(long i) |
| 32 | { |
| 33 | PGValue *v = makeNode(PGValue); |
| 34 | |
| 35 | v->type = T_PGInteger; |
| 36 | v->val.ival = i; |
| 37 | return v; |
| 38 | } |
| 39 | |
| 40 | /* |
| 41 | * makeFloat |
| 42 | * |
| 43 | * Caller is responsible for passing a palloc'd string. |
| 44 | */ |
| 45 | PGValue * |
| 46 | makeFloat(char *numericStr) |
| 47 | { |
| 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 | */ |
| 60 | PGValue * |
| 61 | makeString(const char *str) |
| 62 | { |
| 63 | PGValue *v = makeNode(PGValue); |
| 64 | |
| 65 | v->type = T_PGString; |
| 66 | v->val.str = (char*) str; |
| 67 | return v; |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * makeBitString |
| 72 | * |
| 73 | * Caller is responsible for passing a palloc'd string. |
| 74 | */ |
| 75 | |
| 76 | |