diff options
Diffstat (limited to 'src/backend/access/common')
-rw-r--r-- | src/backend/access/common/heaptuple.c | 35 | ||||
-rw-r--r-- | src/backend/access/common/indextuple.c | 22 | ||||
-rw-r--r-- | src/backend/access/common/printtup.c | 32 | ||||
-rw-r--r-- | src/backend/access/common/tupdesc.c | 101 |
4 files changed, 83 insertions, 107 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 9bb08054943..1f9622e39ba 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.70 2001/03/22 03:59:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.71 2001/03/22 06:16:06 momjian Exp $ * * NOTES * The old interface functions have been converted to macros @@ -246,9 +246,8 @@ nocachegetattr(HeapTuple tuple, * there's a null somewhere in the tuple */ - /* ---------------- - * check to see if desired att is null - * ---------------- + /* + * check to see if desired att is null */ #ifdef IN_MACRO @@ -261,9 +260,8 @@ nocachegetattr(HeapTuple tuple, } #endif - /* ---------------- - * Now check to see if any preceding bits are null... - * ---------------- + /* + * Now check to see if any preceding bits are null... */ { int byte = attnum >> 3; @@ -658,9 +656,8 @@ heap_modifytuple(HeapTuple tuple, HeapTuple newTuple; uint8 infomask; - /* ---------------- - * sanity checks - * ---------------- + /* + * sanity checks */ Assert(HeapTupleIsValid(tuple)); Assert(RelationIsValid(relation)); @@ -670,10 +667,9 @@ heap_modifytuple(HeapTuple tuple, numberOfAttributes = RelationGetForm(relation)->relnatts; - /* ---------------- - * allocate and fill *value and *nulls arrays from either - * the tuple or the repl information, as appropriate. - * ---------------- + /* + * allocate and fill *value and *nulls arrays from either the tuple or + * the repl information, as appropriate. */ value = (Datum *) palloc(numberOfAttributes * sizeof *value); nulls = (char *) palloc(numberOfAttributes * sizeof *nulls); @@ -701,17 +697,16 @@ heap_modifytuple(HeapTuple tuple, } } - /* ---------------- - * create a new tuple from the *values and *nulls arrays - * ---------------- + /* + * create a new tuple from the *values and *nulls arrays */ newTuple = heap_formtuple(RelationGetDescr(relation), value, nulls); - /* ---------------- - * copy the header except for t_len, t_natts, t_hoff, t_bits, t_infomask - * ---------------- + /* + * copy the header except for t_len, t_natts, t_hoff, t_bits, + * t_infomask */ infomask = newTuple->t_data->t_infomask; memmove((char *) &newTuple->t_data->t_oid, /* XXX */ diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index da8129f307f..5c165e2c779 100644 --- a/src/backend/access/common/indextuple.c +++ b/src/backend/access/common/indextuple.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.53 2001/03/22 03:59:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.54 2001/03/22 06:16:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -165,9 +165,8 @@ index_formtuple(TupleDesc tupleDescriptor, infomask |= size; - /* ---------------- + /* * initialize metadata - * ---------------- */ tuple->t_info = infomask; return tuple; @@ -205,9 +204,9 @@ nocache_index_getattr(IndexTuple tup, int data_off; /* tuple data offset */ (void) isnull; /* not used */ - /* ---------------- - * sanity checks - * ---------------- + + /* + * sanity checks */ /* ---------------- @@ -246,9 +245,9 @@ nocache_index_getattr(IndexTuple tup, } else { /* there's a null somewhere in the tuple */ - /* ---------------- - * check to see if desired att is null - * ---------------- + + /* + * check to see if desired att is null */ /* XXX "knows" t_bits are just after fixed tuple header! */ @@ -264,9 +263,8 @@ nocache_index_getattr(IndexTuple tup, } #endif - /* ---------------- - * Now check to see if any preceding bits are null... - * ---------------- + /* + * Now check to see if any preceding bits are null... */ { int byte = attnum >> 3; diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index d44bfe973e0..da95edfc1fe 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.58 2001/03/22 03:59:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.59 2001/03/22 06:16:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -155,16 +155,14 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) if (myState->attrinfo != typeinfo || myState->nattrs != natts) printtup_prepare_info(myState, typeinfo, natts); - /* ---------------- - * tell the frontend to expect new tuple data (in ASCII style) - * ---------------- + /* + * tell the frontend to expect new tuple data (in ASCII style) */ pq_beginmessage(&buf); pq_sendbyte(&buf, 'D'); - /* ---------------- - * send a bitmap of which attributes are not null - * ---------------- + /* + * send a bitmap of which attributes are not null */ j = 0; k = 1 << 7; @@ -183,9 +181,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) if (k != (1 << 7)) /* flush last partial byte */ pq_sendint(&buf, j, 1); - /* ---------------- - * send the attributes of this tuple - * ---------------- + /* + * send the attributes of this tuple */ for (i = 0; i < natts; ++i) { @@ -357,16 +354,14 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) if (myState->attrinfo != typeinfo || myState->nattrs != natts) printtup_prepare_info(myState, typeinfo, natts); - /* ---------------- - * tell the frontend to expect new tuple data (in binary style) - * ---------------- + /* + * tell the frontend to expect new tuple data (in binary style) */ pq_beginmessage(&buf); pq_sendbyte(&buf, 'B'); - /* ---------------- - * send a bitmap of which attributes are not null - * ---------------- + /* + * send a bitmap of which attributes are not null */ j = 0; k = 1 << 7; @@ -385,9 +380,8 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self) if (k != (1 << 7)) /* flush last partial byte */ pq_sendint(&buf, j, 1); - /* ---------------- - * send the attributes of this tuple - * ---------------- + /* + * send the attributes of this tuple */ #ifdef IPORTAL_DEBUG fprintf(stderr, "sending tuple with %d atts\n", natts); diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index e07c6296d15..769f754b669 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.72 2001/03/22 03:59:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.73 2001/03/22 06:16:06 momjian Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -37,17 +37,15 @@ CreateTemplateTupleDesc(int natts) uint32 size; TupleDesc desc; - /* ---------------- - * sanity checks - * ---------------- + /* + * sanity checks */ AssertArg(natts >= 1); - /* ---------------- - * allocate enough memory for the tuple descriptor and - * zero it as TupleDescInitEntry assumes that the descriptor - * is filled with NULL pointers. - * ---------------- + /* + * allocate enough memory for the tuple descriptor and zero it as + * TupleDescInitEntry assumes that the descriptor is filled with NULL + * pointers. */ size = natts * sizeof(Form_pg_attribute); desc = (TupleDesc) palloc(sizeof(struct tupleDesc)); @@ -71,9 +69,8 @@ CreateTupleDesc(int natts, Form_pg_attribute *attrs) { TupleDesc desc; - /* ---------------- - * sanity checks - * ---------------- + /* + * sanity checks */ AssertArg(natts >= 1); @@ -337,9 +334,8 @@ TupleDescInitEntry(TupleDesc desc, Form_pg_type typeForm; Form_pg_attribute att; - /* ---------------- - * sanity checks - * ---------------- + /* + * sanity checks */ AssertArg(PointerIsValid(desc)); AssertArg(attributeNumber >= 1); @@ -352,17 +348,15 @@ TupleDescInitEntry(TupleDesc desc, AssertArg(!PointerIsValid(desc->attrs[attributeNumber - 1])); - /* ---------------- - * allocate storage for this attribute - * ---------------- + /* + * allocate storage for this attribute */ att = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE); desc->attrs[attributeNumber - 1] = att; - /* ---------------- - * initialize the attribute fields - * ---------------- + /* + * initialize the attribute fields */ att->attrelid = 0; /* dummy value */ @@ -404,10 +398,10 @@ TupleDescInitEntry(TupleDesc desc, 0, 0, 0); if (!HeapTupleIsValid(tuple)) { - /* ---------------- - * here type info does not exist yet so we just fill - * the attribute with dummy information and return false. - * ---------------- + + /* + * here type info does not exist yet so we just fill the attribute + * with dummy information and return false. */ att->atttypid = InvalidOid; att->attlen = (int16) 0; @@ -417,32 +411,30 @@ TupleDescInitEntry(TupleDesc desc, return false; } - /* ---------------- - * type info exists so we initialize our attribute - * information from the type tuple we found.. - * ---------------- + /* + * type info exists so we initialize our attribute information from + * the type tuple we found.. */ typeForm = (Form_pg_type) GETSTRUCT(tuple); att->atttypid = tuple->t_data->t_oid; - /*------------------------ + /* * There are a couple of cases where we must override the information * stored in pg_type. * * First: if this attribute is a set, what is really stored in the - * attribute is the OID of a tuple in the pg_proc catalog. - * The pg_proc tuple contains the query string which defines - * this set - i.e., the query to run to get the set. - * So the atttypid (just assigned above) refers to the type returned - * by this query, but the actual length of this attribute is the - * length (size) of an OID. + * attribute is the OID of a tuple in the pg_proc catalog. The pg_proc + * tuple contains the query string which defines this set - i.e., the + * query to run to get the set. So the atttypid (just assigned above) + * refers to the type returned by this query, but the actual length of + * this attribute is the length (size) of an OID. * - * (Why not just make the atttypid point to the OID type, instead - * of the type the query returns? Because the executor uses the atttypid - * to tell the front end what type will be returned (in BeginCommand), - * and in the end the type returned will be the result of the query, not - * an OID.) + * (Why not just make the atttypid point to the OID type, instead of the + * type the query returns? Because the executor uses the atttypid to + * tell the front end what type will be returned (in BeginCommand), + * and in the end the type returned will be the result of the query, + * not an OID.) * * (Why not wait until the return type of the set is known (i.e., the * recursive call to the executor to execute the set has returned) @@ -460,7 +452,6 @@ TupleDescInitEntry(TupleDesc desc, * * A set of complex type is first and foremost a set, so its * representation is Oid not pointer. So, test that case first. - *----------------------------------------- */ if (attisset) { @@ -550,9 +541,8 @@ BuildDescForRelation(List *schema, char *relname) int ndef = 0; bool attisset; - /* ---------------- - * allocate a new tuple descriptor - * ---------------- + /* + * allocate a new tuple descriptor */ natts = length(schema); desc = CreateTemplateTupleDesc(natts); @@ -565,11 +555,10 @@ BuildDescForRelation(List *schema, char *relname) ColumnDef *entry = lfirst(p); List *arry; - /* ---------------- - * for each entry in the list, get the name and type - * information from the list and have TupleDescInitEntry - * fill in the attribute information we need. - * ---------------- + /* + * for each entry in the list, get the name and type information + * from the list and have TupleDescInitEntry fill in the attribute + * information we need. */ attnum++; @@ -595,12 +584,12 @@ BuildDescForRelation(List *schema, char *relname) typenameTypeId(typename), atttypmod, attdim, attisset)) { - /* ---------------- - * if TupleDescInitEntry() fails, it means there is - * no type in the system catalogs. So now we check if - * the type name equals the relation name. If so we - * have a self reference, otherwise it's an error. - * ---------------- + + /* + * if TupleDescInitEntry() fails, it means there is no type in + * the system catalogs. So now we check if the type name + * equals the relation name. If so we have a self reference, + * otherwise it's an error. */ if (strcmp(typename, relname) == 0) TupleDescMakeSelfReference(desc, attnum, relname); |