mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
heapattr functions now return a Datum, not char *.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.24 1997/09/08 21:40:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.25 1997/09/12 04:07:06 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The old interface functions have been converted to macros
|
||||
@@ -372,25 +372,25 @@ heap_sysattrbyval(AttrNumber attno)
|
||||
* heap_getsysattr
|
||||
* ----------------
|
||||
*/
|
||||
char *
|
||||
Datum
|
||||
heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
{
|
||||
switch (attnum)
|
||||
{
|
||||
case SelfItemPointerAttributeNumber:
|
||||
return ((char *) &tup->t_ctid);
|
||||
return ((Datum) &tup->t_ctid);
|
||||
case ObjectIdAttributeNumber:
|
||||
return ((char *) (long) tup->t_oid);
|
||||
return ((Datum) (long) tup->t_oid);
|
||||
case MinTransactionIdAttributeNumber:
|
||||
return ((char *) (long) tup->t_xmin);
|
||||
return ((Datum) (long) tup->t_xmin);
|
||||
case MinCommandIdAttributeNumber:
|
||||
return ((char *) (long) tup->t_cmin);
|
||||
return ((Datum) (long) tup->t_cmin);
|
||||
case MaxTransactionIdAttributeNumber:
|
||||
return ((char *) (long) tup->t_xmax);
|
||||
return ((Datum) (long) tup->t_xmax);
|
||||
case MaxCommandIdAttributeNumber:
|
||||
return ((char *) (long) tup->t_cmax);
|
||||
return ((Datum) (long) tup->t_cmax);
|
||||
case ChainItemPointerAttributeNumber:
|
||||
return ((char *) &tup->t_chain);
|
||||
return ((Datum) &tup->t_chain);
|
||||
case AnchorItemPointerAttributeNumber:
|
||||
elog(WARN, "heap_getsysattr: t_anchor does not exist!");
|
||||
break;
|
||||
@@ -409,7 +409,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
|
||||
TransactionIdDidCommit(tup->t_xmin))
|
||||
tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
|
||||
return ((char *) (long) tup->t_tmin);
|
||||
return ((Datum) (long) tup->t_tmin);
|
||||
case MaxAbsoluteTimeAttributeNumber:
|
||||
if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
|
||||
{
|
||||
@@ -418,9 +418,9 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
else
|
||||
tup->t_tmax = CURRENT_ABSTIME;
|
||||
}
|
||||
return ((char *) (long) tup->t_tmax);
|
||||
return ((Datum) (long) tup->t_tmax);
|
||||
case VersionTypeAttributeNumber:
|
||||
return ((char *) (long) tup->t_vtype);
|
||||
return ((Datum) (long) tup->t_vtype);
|
||||
default:
|
||||
elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
|
||||
}
|
||||
@@ -444,7 +444,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
|
||||
* the same attribute descriptor will go much quicker. -cim 5/4/91
|
||||
* ----------------
|
||||
*/
|
||||
char *
|
||||
Datum
|
||||
fastgetattr(HeapTuple tup,
|
||||
int attnum,
|
||||
TupleDesc tupleDesc,
|
||||
@@ -479,7 +479,7 @@ fastgetattr(HeapTuple tup,
|
||||
attnum--;
|
||||
if (att[attnum]->attcacheoff > 0)
|
||||
{
|
||||
return (char *)
|
||||
return (Datum)
|
||||
fetchatt(&(att[attnum]),
|
||||
(char *) tup + tup->t_hoff + att[attnum]->attcacheoff);
|
||||
}
|
||||
@@ -489,7 +489,7 @@ fastgetattr(HeapTuple tup,
|
||||
/*
|
||||
* first attribute is always at position zero
|
||||
*/
|
||||
return ((char *) fetchatt(&(att[0]), (char *) tup + tup->t_hoff));
|
||||
return ((Datum) fetchatt(&(att[0]), (char *) tup + tup->t_hoff));
|
||||
}
|
||||
|
||||
tp = (char *) tup + tup->t_hoff;
|
||||
@@ -543,13 +543,13 @@ fastgetattr(HeapTuple tup,
|
||||
{
|
||||
if (att[attnum]->attcacheoff > 0)
|
||||
{
|
||||
return (char *)
|
||||
return (Datum)
|
||||
fetchatt(&(att[attnum]),
|
||||
tp + att[attnum]->attcacheoff);
|
||||
}
|
||||
else if (attnum == 0)
|
||||
{
|
||||
return (char *)
|
||||
return (Datum)
|
||||
fetchatt(&(att[0]), (char *) tup + tup->t_hoff);
|
||||
}
|
||||
else if (!HeapTupleAllFixed(tup))
|
||||
@@ -618,7 +618,7 @@ fastgetattr(HeapTuple tup,
|
||||
}
|
||||
|
||||
return
|
||||
(char *) fetchatt(&(att[attnum]), tp + att[attnum]->attcacheoff);
|
||||
(Datum) fetchatt(&(att[attnum]), tp + att[attnum]->attcacheoff);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -729,7 +729,7 @@ fastgetattr(HeapTuple tup,
|
||||
off = LONGALIGN(off);
|
||||
break;
|
||||
}
|
||||
return ((char *) fetchatt(&(att[attnum]), tp + off));
|
||||
return ((Datum) fetchatt(&(att[attnum]), tp + off));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,11 +782,11 @@ heap_deformtuple(HeapTuple tuple,
|
||||
{
|
||||
bool isnull;
|
||||
|
||||
values[i] = (Datum) heap_getattr(tuple,
|
||||
InvalidBuffer,
|
||||
i + 1,
|
||||
tdesc,
|
||||
&isnull);
|
||||
values[i] = heap_getattr(tuple,
|
||||
InvalidBuffer,
|
||||
i + 1,
|
||||
tdesc,
|
||||
&isnull);
|
||||
if (isnull)
|
||||
nulls[i] = 'n';
|
||||
else
|
||||
@@ -936,15 +936,12 @@ heap_modifytuple(HeapTuple tuple,
|
||||
|
||||
if (repl[attoff] == ' ')
|
||||
{
|
||||
char *attr;
|
||||
|
||||
attr =
|
||||
value[attoff] =
|
||||
heap_getattr(tuple,
|
||||
InvalidBuffer,
|
||||
AttrOffsetGetAttrNumber(attoff),
|
||||
RelationGetTupleDescriptor(relation),
|
||||
&isNull);
|
||||
value[attoff] = PointerGetDatum(attr);
|
||||
nulls[attoff] = (isNull) ? 'n' : ' ';
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.18 1997/09/08 02:19:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.19 1997/09/12 04:07:09 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,10 +42,10 @@ heap_keytest(HeapTuple t,
|
||||
|
||||
for (; nkeys--; keys++)
|
||||
{
|
||||
atp = (Datum) heap_getattr(t, InvalidBuffer,
|
||||
keys->sk_attno,
|
||||
tupdesc,
|
||||
&isnull);
|
||||
atp = heap_getattr(t, InvalidBuffer,
|
||||
keys->sk_attno,
|
||||
tupdesc,
|
||||
&isnull);
|
||||
|
||||
if (isnull)
|
||||
/* XXX eventually should check if SK_ISNULL */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.17 1997/09/08 02:19:56 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.18 1997/09/12 04:07:12 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -76,8 +76,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
int i,
|
||||
j,
|
||||
k;
|
||||
char *outputstr,
|
||||
*attr;
|
||||
char *outputstr;
|
||||
Datum attr;
|
||||
bool isnull;
|
||||
Oid typoutput;
|
||||
|
||||
@@ -176,8 +176,8 @@ void
|
||||
debugtup(HeapTuple tuple, TupleDesc typeinfo)
|
||||
{
|
||||
register int i;
|
||||
char *attr,
|
||||
*value;
|
||||
Datum attr;
|
||||
char *value;
|
||||
bool isnull;
|
||||
Oid typoutput;
|
||||
|
||||
@@ -212,7 +212,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
|
||||
int i,
|
||||
j,
|
||||
k;
|
||||
char *attr;
|
||||
Datum attr;
|
||||
bool isnull;
|
||||
|
||||
/* ----------------
|
||||
@@ -308,9 +308,10 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
|
||||
else
|
||||
{
|
||||
pq_putint(len, sizeof(int32));
|
||||
pq_putnchar(attr, len);
|
||||
pq_putnchar(DatumGetPointer(attr), len);
|
||||
#ifdef IPORTAL_DEBUG
|
||||
fprintf(stderr, "byref length %d data %x\n", len, attr);
|
||||
fprintf(stderr, "byref length %d data %x\n", len,
|
||||
DatumGetPointer(attr));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user