8000 Add comments describing interface to heap_getattr(). · MangeshVC/postgres@b36e304 · GitHub
[go: up one dir, main page]

Skip to content

Commit b36e304

Browse files
author
Bryan Henderson
committed
Add comments describing interface to heap_getattr().
1 parent 6cfb12e commit b36e304

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

src/backend/access/common/heaptuple.c

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.17 1996/12/04 03:05:55 bryanh Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.18 1996/12/09 01:22:17 bryanh Exp $
1212
*
1313
* NOTES
1414
* The old interface functions have been converted to macros
@@ -658,52 +658,61 @@ fastgetattr(HeapTuple tup,
658658
}
659659

660660
/* ----------------
661-
* heap_getattr
661+
* heap_getattr
662662
*
663-
* returns an attribute from a heap tuple. uses
664-
* ----------------
665-
*/
663+
* Find a particular field in a row represented as a heap tuple.
664+
* We return a pointer into that heap tuple, which points to the
665+
* first byte of the value of the field in question.
666+
*
667+
* If the field in question has a NULL value, we return a null
668+
* pointer and return <*isnull> == true. Otherwise, we return
669+
* <*isnull> == false.
670+
*
671+
* <tup> is the pointer to the heap tuple. <attnum> is the attribute
672+
* number of the column (field) caller wants. <tupleDesc> is a
673+
* pointer to the structure describing the row and all its fields.
674+
* ---------------- */
666675
char *
667676
heap_getattr(HeapTuple tup,
668-
Buffer b,
669-
int attnum,
670-
TupleDesc tupleDesc,
671-
bool *isnull)
677+
Buffer b,
678+
int attnum,
679+
TupleDesc tupleDesc,
680+
bool *isnull)
672681
{
673-
bool localIsNull;
682+
bool localIsNull;
674683

675684
/* ----------------
676-
* sanity checks
685+
* sanity checks
677686
* ----------------
678687
*/
679688
Assert(tup != NULL);
680689

681690
if (! PointerIsValid(isnull))
682-
isnull = &localIsNull;
691+
isnull = &localIsNull;
683692

684693
if (attnum > (int) tup->t_natts) {
685-
*isnull = true;
686-
return ((char *) NULL);
694+
*isnull = true;
695+
return ((char *) NULL);
687696
}
688697

689698
/* ----------------
690-
* take care of user defined attributes
699+
* take care of user defined attributes
691700
* ----------------
692701
*/
693702
if (attnum > 0) {
694-
char *datum;
695-
datum = fastgetattr(tup, attnum, tupleDesc, isnull);
696-
697-
return (datum);
703+
char *datum;
704+
datum = fastgetattr(tup, attnum, tupleDesc, isnull);
705+
706+
return (datum);
698707
}
699708

700709
/* ----------------
701-
* take care of system attributes
710+
* take care of system attributes
702711
* ----------------
703712
*/
704713
*isnull = false;
705714
return
706-
heap_getsysattr(tup, b, attnum);
715+
heap_getsysattr(tup, b, attnum);
707716
}
708717

709718
/* ----------------

0 commit comments

Comments
 (0)
0