1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* datum.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES abstract data type datum representation definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-02-26 05:46:47 +01:00
|
|
|
* $Id: datum.h,v 1.7 1998/02/26 04:43:57 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef DATUM_H
|
|
|
|
#define DATUM_H
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------
|
|
|
|
* SOME NOT VERY PORTABLE ROUTINES ???
|
|
|
|
*--------------------------------------------------------
|
|
|
|
*
|
|
|
|
* In the implementation of the next routines we assume the following:
|
|
|
|
*
|
|
|
|
* A) if a type is "byVal" then all the information is stored in the
|
|
|
|
* Datum itself (i.e. no pointers involved!). In this case the
|
|
|
|
* length of the type is always greater than zero and less than
|
|
|
|
* "sizeof(Datum)"
|
|
|
|
* B) if a type is not "byVal" and it has a fixed length, then
|
|
|
|
* the "Datum" always contain a pointer to a stream of bytes.
|
|
|
|
* The number of significant bytes are always equal to the length of thr
|
|
|
|
* type.
|
|
|
|
* C) if a type is not "byVal" and is of variable length (i.e. it has
|
|
|
|
* length == -1) then "Datum" always points to a "struct varlena".
|
|
|
|
* This varlena structure has information about the actual length of this
|
|
|
|
* particular instance of the type and about its value.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*---------------
|
|
|
|
* datumGetSize
|
|
|
|
* find the "real" length of a datum
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern Size datumGetSize(Datum value, Oid type, bool byVal, Size len);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*---------------
|
|
|
|
* datumCopy
|
|
|
|
* make a copy of a datum.
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern Datum datumCopy(Datum value, Oid type, bool byVal, Size len);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*---------------
|
|
|
|
* datumFree
|
|
|
|
* free space that *might* have been palloced by "datumCopy"
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void datumFree(Datum value, Oid type, bool byVal, Size len);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*---------------
|
|
|
|
* datumIsEqual
|
|
|
|
* return true if thwo datums are equal, false otherwise.
|
|
|
|
* XXX : See comments in the code for restrictions!
|
|
|
|
*/
|
1998-02-26 05:46:47 +01:00
|
|
|
extern bool
|
|
|
|
datumIsEqual(Datum value1, Datum value2, Oid type,
|
1996-08-28 03:59:28 +02:00
|
|
|
bool byVal, Size len);
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* DATUM_H */
|