|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.40 1999/01/27 00:36:22 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.41 1999/01/27 01:11:43 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -75,7 +75,7 @@ getTypeOutAndElem(Oid type, Oid* typOutput, Oid* typElem)
|
75 | 75 | typedef struct { /* Per-attribute information */
|
76 | 76 | Oid typoutput; /* Oid for the attribute's type output fn */
|
77 | 77 | Oid typelem; /* typelem value to pass to the output fn */
|
78 |
| - /* more soon... */ |
| 78 | + FmgrInfo finfo; /* Precomputed call info for typoutput */ |
79 | 79 | } PrinttupAttrInfo;
|
80 | 80 |
|
81 | 81 | typedef struct {
|
@@ -138,8 +138,9 @@ printtup_prepare_info(DR_printtup* myState, TupleDesc typeinfo, int numAttrs)
|
138 | 138 | for (i = 0; i < numAttrs; i++)
|
139 | 139 | {
|
140 | 140 | PrinttupAttrInfo* thisState = myState->myinfo + i;
|
141 |
| - getTypeOutAndElem((Oid) typeinfo->attrs[i]->atttypid, |
142 |
| - &thisState->typoutput, &thisState->typelem); |
| 141 | + if (getTypeOutAndElem((Oid) typeinfo->attrs[i]->atttypid, |
| 142 | + &thisState->typoutput, &thisState->typelem)) |
| 143 | + fmgr_info(thisState->typoutput, &thisState->finfo); |
143 | 144 | }
|
144 | 145 | }
|
145 | 146 |
|
@@ -200,15 +201,14 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver* self)
|
200 | 201 | */
|
201 | 202 | for (i = 0; i < tuple->t_data->t_natts; ++i)
|
202 | 203 | {
|
| 204 | + PrinttupAttrInfo* thisState = myState->myinfo + i; |
203 | 205 | attr = heap_getattr(tuple, i + 1, typeinfo, &isnull);
|
204 | 206 | if (isnull)
|
205 | 207 | continue;
|
206 |
| - if (OidIsValid(myState->myinfo[i].typoutput)) |
| 208 | + if (OidIsValid(thisState->typoutput)) |
207 | 209 | {
|
208 |
| - outputstr = fmgr(myState->myinfo[i].typoutput, |
209 |
| - attr, |
210 |
| - myState->myinfo[i].typelem, |
211 |
| - typeinfo->attrs[i]->atttypmod); |
| 210 | + outputstr = (char *) (*fmgr_faddr(&thisState->finfo)) |
| 211 | + (attr, thisState->typelem, typeinfo->attrs[i]->atttypmod); |
212 | 212 | #ifdef MULTIBYTE
|
213 | 213 | p = pg_server_to_client(outputstr, strlen(outputstr));
|
214 | 214 | outputlen = strlen(p);
|
|
0 commit comments