1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* itemid.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* Standard POSTGRES buffer page item identifier definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2001-11-05 18:46:40 +01:00
|
|
|
* $Id: itemid.h,v 1.19 2001/11/05 17:46:35 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef ITEMID_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define ITEMID_H
|
|
|
|
|
2000-08-07 22:16:13 +02:00
|
|
|
/*
|
|
|
|
* An item pointer (also called line pointer) on a buffer page
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct ItemIdData
|
|
|
|
{ /* line pointers */
|
2000-08-07 22:16:13 +02:00
|
|
|
unsigned lp_off:15, /* offset to start of tuple */
|
|
|
|
lp_flags:2, /* flags for tuple */
|
1998-01-13 05:05:12 +01:00
|
|
|
lp_len:15; /* length of tuple */
|
1997-09-08 23:56:23 +02:00
|
|
|
} ItemIdData;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-08-07 22:16:13 +02:00
|
|
|
typedef ItemIdData *ItemId;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-08-07 22:16:13 +02:00
|
|
|
/*
|
|
|
|
* lp_flags contains these flags:
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define LP_USED 0x01 /* this line pointer is being used */
|
2000-08-07 22:16:13 +02:00
|
|
|
|
2001-03-22 05:01:46 +01:00
|
|
|
#define LP_DELETE 0x02 /* item is to be deleted */
|
2000-09-07 11:58:38 +02:00
|
|
|
|
|
|
|
#define ItemIdDeleted(itemId) \
|
|
|
|
(((itemId)->lp_flags & LP_DELETE) != 0)
|
|
|
|
|
2000-10-20 13:01:21 +02:00
|
|
|
/*
|
|
|
|
* This bit may be passed to PageAddItem together with
|
|
|
|
* LP_USED & LP_DELETED bits to specify overwrite mode
|
|
|
|
*/
|
2001-03-22 05:01:46 +01:00
|
|
|
#define OverwritePageMode 0x10
|
2000-10-20 13:01:21 +02:00
|
|
|
|
2000-08-07 22:16:13 +02:00
|
|
|
/*
|
|
|
|
* Item offsets, lengths, and flags are represented by these types when
|
|
|
|
* they're not actually stored in an ItemIdData.
|
|
|
|
*/
|
|
|
|
typedef uint16 ItemOffset;
|
|
|
|
typedef uint16 ItemLength;
|
|
|
|
|
|
|
|
typedef bits16 ItemIdFlags;
|
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* support macros
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
2000-08-07 22:16:13 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* ItemIdGetLength
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define ItemIdGetLength(itemId) \
|
|
|
|
((itemId)->lp_len)
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* ItemIdGetOffset
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define ItemIdGetOffset(itemId) \
|
|
|
|
((itemId)->lp_off)
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* ItemIdGetFlags
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define ItemIdGetFlags(itemId) \
|
|
|
|
((itemId)->lp_flags)
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* ItemIdIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff disk item identifier is valid.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define ItemIdIsValid(itemId) PointerIsValid(itemId)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* ItemIdIsUsed
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff disk item identifier is in use.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* Assumes disk item identifier is valid.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define ItemIdIsUsed(itemId) \
|
1998-06-15 20:40:05 +02:00
|
|
|
( \
|
|
|
|
AssertMacro(ItemIdIsValid(itemId)), \
|
|
|
|
(bool) (((itemId)->lp_flags & LP_USED) != 0) \
|
|
|
|
)
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* ITEMID_H */
|