From: Bryan Henderson Date: Mon, 9 Dec 1996 01:22:17 +0000 (+0000) Subject: Add comments describing interface to heap_getattr(). X-Git-Tag: REL2_0~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b36e3042e76ba47913c4a8156b2544b42ae62d36;p=postgresql Add comments describing interface to heap_getattr(). --- diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index ccaaba6033..6c2f72c683 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.17 1996/12/04 03:05:55 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.18 1996/12/09 01:22:17 bryanh Exp $ * * NOTES * The old interface functions have been converted to macros @@ -658,52 +658,61 @@ fastgetattr(HeapTuple tup, } /* ---------------- - * heap_getattr + * heap_getattr * - * returns an attribute from a heap tuple. uses - * ---------------- - */ + * 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. + * + * is the pointer to the heap tuple. is the attribute + * number of the column (field) caller wants. is a + * pointer to the structure describing the row and all its fields. + * ---------------- */ char * heap_getattr(HeapTuple tup, - Buffer b, - int attnum, - TupleDesc tupleDesc, - bool *isnull) + Buffer b, + int attnum, + TupleDesc tupleDesc, + bool *isnull) { - bool localIsNull; + bool localIsNull; /* ---------------- - * sanity checks + * sanity checks * ---------------- */ Assert(tup != NULL); if (! PointerIsValid(isnull)) - isnull = &localIsNull; + isnull = &localIsNull; if (attnum > (int) tup->t_natts) { - *isnull = true; - return ((char *) NULL); + *isnull = true; + return ((char *) NULL); } /* ---------------- - * take care of user defined attributes + * take care of user defined attributes * ---------------- */ if (attnum > 0) { - char *datum; - datum = fastgetattr(tup, attnum, tupleDesc, isnull); - - return (datum); + char *datum; + datum = fastgetattr(tup, attnum, tupleDesc, isnull); + + return (datum); } /* ---------------- - * take care of system attributes + * take care of system attributes * ---------------- */ *isnull = false; return - heap_getsysattr(tup, b, attnum); + heap_getsysattr(tup, b, attnum); } /* ----------------