mirror of
https://github.com/postgres/postgres.git
synced 2026-01-13 12:22:55 +03:00
Inlined heap_getattr().
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: heapam.h,v 1.7 1997/08/19 21:37:30 momjian Exp $
|
||||
* $Id: heapam.h,v 1.8 1997/08/26 23:31:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -78,6 +78,30 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
|
||||
#define IncrHeapAccessStat(x) \
|
||||
(heap_access_stats == NULL ? 0 : (heap_access_stats->x)++)
|
||||
|
||||
/* ----------------
|
||||
* heap_getattr
|
||||
*
|
||||
* Find a particular field in a row represented as a heap tuple.
|
||||
* We return a pointer into that heap tuple, which points to the
|
||||
* first byte of the value of the field in question.
|
||||
*
|
||||
* If the field in question has a NULL value, we return a null
|
||||
* pointer and return <*isnull> == true. Otherwise, we return
|
||||
* <*isnull> == false.
|
||||
*
|
||||
* <tup> is the pointer to the heap tuple. <attnum> is the attribute
|
||||
* number of the column (field) caller wants. <tupleDesc> is a
|
||||
* pointer to the structure describing the row and all its fields.
|
||||
* ---------------- */
|
||||
#define heap_getattr(tup, b, attnum, tupleDesc, isnull) \
|
||||
(AssertMacro((tup) != NULL) ? \
|
||||
((attnum) > (int) (tup)->t_natts) ? \
|
||||
(((isnull) ? (*(isnull) = true) : NULL), (char *) NULL) : \
|
||||
((attnum) > 0) ? \
|
||||
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) : \
|
||||
(((isnull) ? (*(isnull) = false) : NULL), heap_getsysattr((tup), (b), (attnum))) : \
|
||||
(char *) NULL)
|
||||
|
||||
extern HeapAccessStatistics heap_access_stats; /* in stats.c */
|
||||
|
||||
/* ----------------
|
||||
@@ -114,10 +138,9 @@ extern void DataFill(char *data, TupleDesc tupleDesc,
|
||||
extern int heap_attisnull(HeapTuple tup, int attnum);
|
||||
extern int heap_sysattrlen(AttrNumber attno);
|
||||
extern bool heap_sysattrbyval(AttrNumber attno);
|
||||
extern char *heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
|
||||
extern char *fastgetattr(HeapTuple tup, int attnum,
|
||||
TupleDesc att, bool *isnull);
|
||||
extern char *heap_getattr(HeapTuple tup, Buffer b, int attnum,
|
||||
TupleDesc att, bool *isnull);
|
||||
extern HeapTuple heap_copytuple(HeapTuple tuple);
|
||||
extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
|
||||
Datum value[], char nulls[]);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* heaptuple.h--
|
||||
*
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: heaptuple.h,v 1.3 1996/11/05 07:18:05 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef HEAPTUPLE_H
|
||||
#define HEAPTUPLE_H
|
||||
|
||||
#include <access/tupdesc.h>
|
||||
#include <storage/buf.h>
|
||||
#include <access/htup.h>
|
||||
|
||||
extern char *heap_getattr(HeapTuple tup,
|
||||
Buffer b,
|
||||
int attnum,
|
||||
TupleDesc tupleDesc,
|
||||
bool *isnull);
|
||||
|
||||
#endif /* HEAP_TUPLE_H */
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: bufpage.h,v 1.9 1997/08/24 23:08:01 momjian Exp $
|
||||
* $Id: bufpage.h,v 1.10 1997/08/26 23:31:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -221,7 +221,7 @@ typedef enum {
|
||||
* Assumes page is locked.
|
||||
*/
|
||||
#define PageGetSpecialSize(page) \
|
||||
((uint16) (PageGetPageSize(page) - ((PageHeader)page)->pd_special))
|
||||
((uint16) (PageGetPageSize(page) - ((PageHeader)(page))->pd_special))
|
||||
|
||||
/*
|
||||
* PageGetSpecialPointer --
|
||||
@@ -245,8 +245,8 @@ typedef enum {
|
||||
*/
|
||||
#define PageGetItem(page, itemId) \
|
||||
(AssertMacro(PageIsValid(page)) ? \
|
||||
AssertMacro(itemId->lp_flags & LP_USED) ? \
|
||||
(Item)(((char *)page) + itemId->lp_off) : false : false)
|
||||
AssertMacro((itemId)->lp_flags & LP_USED) ? \
|
||||
(Item)(((char *)(page)) + (itemId)->lp_off) : false : false)
|
||||
|
||||
/*
|
||||
* BufferGetPageSize --
|
||||
|
||||
Reference in New Issue
Block a user