1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Update textin() and textout() to new fmgr style. This is just phase

one of updating the whole text datatype, but there are so dang many
calls of these two routines that it seems worth a separate commit.
This commit is contained in:
Tom Lane
2000-07-05 23:12:09 +00:00
parent 282713a836
commit 40f64064ff
39 changed files with 286 additions and 271 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.32 2000/06/06 17:44:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.33 2000/07/05 23:11:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -70,7 +70,7 @@ init_fcache(Oid foid,
Form_pg_type typeStruct;
FunctionCachePtr retval;
int nargs;
text *tmp;
Datum tmp;
bool isNull;
retval = (FunctionCachePtr) palloc(sizeof(FunctionCache));
@ -212,14 +212,14 @@ init_fcache(Oid foid,
if (procedureStruct->prolang == SQLlanguageId)
{
tmp = (text *) SysCacheGetAttr(PROCOID,
procedureTuple,
Anum_pg_proc_prosrc,
&isNull);
tmp = SysCacheGetAttr(PROCOID,
procedureTuple,
Anum_pg_proc_prosrc,
&isNull);
if (isNull)
elog(ERROR, "init_fcache: null prosrc for procedure %u",
foid);
retval->src = textout(tmp);
retval->src = DatumGetCString(DirectFunctionCall1(textout, tmp));
retval->bin = (char *) NULL;
}
else
@ -229,14 +229,14 @@ init_fcache(Oid foid,
retval->bin = (char *) NULL;
else
{
tmp = (text *) SysCacheGetAttr(PROCOID,
procedureTuple,
Anum_pg_proc_probin,
&isNull);
tmp = SysCacheGetAttr(PROCOID,
procedureTuple,
Anum_pg_proc_probin,
&isNull);
if (isNull)
elog(ERROR, "init_fcache: null probin for procedure %u",
foid);
retval->bin = textout(tmp);
retval->bin = DatumGetCString(DirectFunctionCall1(textout, tmp));
}
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.105 2000/06/30 07:04:10 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.106 2000/07/05 23:11:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1901,7 +1901,7 @@ AttrDefaultFetch(Relation relation)
IndexScanDesc sd = (IndexScanDesc) NULL;
HeapScanDesc adscan = (HeapScanDesc) NULL;
RetrieveIndexResult indexRes;
struct varlena *val;
Datum val;
bool isnull;
int found;
int i;
@ -1959,16 +1959,17 @@ AttrDefaultFetch(Relation relation)
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
RelationGetRelationName(relation));
val = (struct varlena *) fastgetattr(htup,
Anum_pg_attrdef_adbin,
adrel->rd_att, &isnull);
val = fastgetattr(htup,
Anum_pg_attrdef_adbin,
adrel->rd_att, &isnull);
if (isnull)
elog(NOTICE, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
RelationGetRelationName(relation));
else
attrdef[i].adbin = MemoryContextStrdup(CacheMemoryContext,
textout(val));
DatumGetCString(DirectFunctionCall1(textout,
val)));
break;
}
if (hasindex)
@ -2008,7 +2009,7 @@ RelCheckFetch(Relation relation)
HeapScanDesc rcscan = (HeapScanDesc) NULL;
RetrieveIndexResult indexRes;
Name rcname;
struct varlena *val;
Datum val;
bool isnull;
int found;
bool hasindex;
@ -2066,14 +2067,15 @@ RelCheckFetch(Relation relation)
RelationGetRelationName(relation));
check[found].ccname = MemoryContextStrdup(CacheMemoryContext,
NameStr(*rcname));
val = (struct varlena *) fastgetattr(htup,
Anum_pg_relcheck_rcbin,
rcrel->rd_att, &isnull);
val = fastgetattr(htup,
Anum_pg_relcheck_rcbin,
rcrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
RelationGetRelationName(relation));
check[found].ccbin = MemoryContextStrdup(CacheMemoryContext,
textout(val));
DatumGetCString(DirectFunctionCall1(textout,
val)));
found++;
if (hasindex)
ReleaseBuffer(buffer);