00001 /*------------------------------------------------------------------------- 00002 * 00003 * datum.h 00004 * POSTGRES Datum (abstract data type) manipulation routines. 00005 * 00006 * These routines are driven by the 'typbyval' and 'typlen' information, 00007 * which must previously have been obtained by the caller for the datatype 00008 * of the Datum. (We do it this way because in most situations the caller 00009 * can look up the info just once and use it for many per-datum operations.) 00010 * 00011 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00012 * Portions Copyright (c) 1994, Regents of the University of California 00013 * 00014 * src/include/utils/datum.h 00015 * 00016 *------------------------------------------------------------------------- 00017 */ 00018 #ifndef DATUM_H 00019 #define DATUM_H 00020 00021 /* 00022 * datumGetSize - find the "real" length of a datum 00023 */ 00024 extern Size datumGetSize(Datum value, bool typByVal, int typLen); 00025 00026 /* 00027 * datumCopy - make a copy of a datum. 00028 * 00029 * If the datatype is pass-by-reference, memory is obtained with palloc(). 00030 */ 00031 extern Datum datumCopy(Datum value, bool typByVal, int typLen); 00032 00033 /* 00034 * datumFree - free a datum previously allocated by datumCopy, if any. 00035 * 00036 * Does nothing if datatype is pass-by-value. 00037 */ 00038 extern void datumFree(Datum value, bool typByVal, int typLen); 00039 00040 /* 00041 * datumIsEqual 00042 * return true if two datums of the same type are equal, false otherwise. 00043 * 00044 * XXX : See comments in the code for restrictions! 00045 */ 00046 extern bool datumIsEqual(Datum value1, Datum value2, 00047 bool typByVal, int typLen); 00048 00049 #endif /* DATUM_H */