|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * 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 $ |
12 | 12 | * |
13 | 13 | * NOTES |
14 | 14 | * The old interface functions have been converted to macros |
@@ -658,52 +658,61 @@ fastgetattr(HeapTuple tup, |
658 | 658 | } |
659 | 659 |
|
660 | 660 | /* ---------------- |
661 | | - * heap_getattr |
| 661 | + * heap_getattr |
662 | 662 | * |
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 | + * ---------------- */ |
666 | 675 | char * |
667 | 676 | 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) |
672 | 681 | { |
673 | | - bool localIsNull; |
| 682 | + bool localIsNull; |
674 | 683 |
|
675 | 684 | /* ---------------- |
676 | | - * sanity checks |
| 685 | + * sanity checks |
677 | 686 | * ---------------- |
678 | 687 | */ |
679 | 688 | Assert(tup != NULL); |
680 | 689 |
|
681 | 690 | if (! PointerIsValid(isnull)) |
682 | | - isnull = &localIsNull; |
| 691 | + isnull = &localIsNull; |
683 | 692 |
|
684 | 693 | if (attnum > (int) tup->t_natts) { |
685 | | - *isnull = true; |
686 | | - return ((char *) NULL); |
| 694 | + *isnull = true; |
| 695 | + return ((char *) NULL); |
687 | 696 | } |
688 | 697 |
|
689 | 698 | /* ---------------- |
690 | | - * take care of user defined attributes |
| 699 | + * take care of user defined attributes |
691 | 700 | * ---------------- |
692 | 701 | */ |
693 | 702 | 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); |
698 | 707 | } |
699 | 708 |
|
700 | 709 | /* ---------------- |
701 | | - * take care of system attributes |
| 710 | + * take care of system attributes |
702 | 711 | * ---------------- |
703 | 712 | */ |
704 | 713 | *isnull = false; |
705 | 714 | return |
706 | | - heap_getsysattr(tup, b, attnum); |
| 715 | + heap_getsysattr(tup, b, attnum); |
707 | 716 | } |
708 | 717 |
|
709 | 718 | /* ---------------- |
|
0 commit comments