1 /*-------------------------------------------------------------------------
4 * POSTGRES abstract data type datum representation definitions.
7 * Copyright (c) 1994, Regents of the University of California
9 * $Id: datum.h,v 1.3 1997/09/07 05:02:17 momjian Exp $
11 *-------------------------------------------------------------------------
17 /*--------------------------------------------------------
18 * SOME NOT VERY PORTABLE ROUTINES ???
19 *--------------------------------------------------------
21 * In the implementation of the next routines we assume the following:
23 * A) if a type is "byVal" then all the information is stored in the
24 * Datum itself (i.e. no pointers involved!). In this case the
25 * length of the type is always greater than zero and less than
27 * B) if a type is not "byVal" and it has a fixed length, then
28 * the "Datum" always contain a pointer to a stream of bytes.
29 * The number of significant bytes are always equal to the length of thr
31 * C) if a type is not "byVal" and is of variable length (i.e. it has
32 * length == -1) then "Datum" always points to a "struct varlena".
33 * This varlena structure has information about the actual length of this
34 * particular instance of the type and about its value.
39 * find the "real" length of a datum
41 extern Size datumGetSize(Datum value, Oid type, bool byVal, Size len);
45 * make a copy of a datum.
47 extern Datum datumCopy(Datum value, Oid type, bool byVal, Size len);
51 * free space that *might* have been palloced by "datumCopy"
53 extern void datumFree(Datum value, Oid type, bool byVal, Size len);
57 * return true if thwo datums are equal, false otherwise.
58 * XXX : See comments in the code for restrictions!
61 datumIsEqual(Datum value1, Datum value2, Oid type,
62 bool byVal, Size len);