00001 /*------------------------------------------------------------------------- 00002 * 00003 * value.c 00004 * implementation of Value nodes 00005 * 00006 * 00007 * Copyright (c) 2003-2013, PostgreSQL Global Development Group 00008 * 00009 * 00010 * IDENTIFICATION 00011 * src/backend/nodes/value.c 00012 * 00013 *------------------------------------------------------------------------- 00014 */ 00015 #include "postgres.h" 00016 00017 #include "nodes/parsenodes.h" 00018 00019 /* 00020 * makeInteger 00021 */ 00022 Value * 00023 makeInteger(long i) 00024 { 00025 Value *v = makeNode(Value); 00026 00027 v->type = T_Integer; 00028 v->val.ival = i; 00029 return v; 00030 } 00031 00032 /* 00033 * makeFloat 00034 * 00035 * Caller is responsible for passing a palloc'd string. 00036 */ 00037 Value * 00038 makeFloat(char *numericStr) 00039 { 00040 Value *v = makeNode(Value); 00041 00042 v->type = T_Float; 00043 v->val.str = numericStr; 00044 return v; 00045 } 00046 00047 /* 00048 * makeString 00049 * 00050 * Caller is responsible for passing a palloc'd string. 00051 */ 00052 Value * 00053 makeString(char *str) 00054 { 00055 Value *v = makeNode(Value); 00056 00057 v->type = T_String; 00058 v->val.str = str; 00059 return v; 00060 } 00061 00062 /* 00063 * makeBitString 00064 * 00065 * Caller is responsible for passing a palloc'd string. 00066 */ 00067 Value * 00068 makeBitString(char *str) 00069 { 00070 Value *v = makeNode(Value); 00071 00072 v->type = T_BitString; 00073 v->val.str = str; 00074 return v; 00075 }