*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.43 2000/05/28 17:55:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.46 2000/07/14 22:17:30 tgl Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
* ----------------
*/
specificResult = (InsertIndexResult)
- fmgr(procedure, relation, datum, nulls, heap_t_ctid, heapRel, NULL);
+ DatumGetPointer(OidFunctionCall5(procedure,
+ PointerGetDatum(relation),
+ PointerGetDatum(datum),
+ PointerGetDatum(nulls),
+ PointerGetDatum(heap_t_ctid),
+ PointerGetDatum(heapRel)));
/* must be pfree'ed */
return specificResult;
RELATION_CHECKS;
GET_REL_PROCEDURE(delete, amdelete);
- fmgr(procedure, relation, indexItem);
+ OidFunctionCall2(procedure,
+ PointerGetDatum(relation),
+ PointerGetDatum(indexItem));
}
/* ----------------
LockRelation(relation, AccessShareLock);
scandesc = (IndexScanDesc)
- fmgr(procedure, relation, scanFromEnd, numberOfKeys, key);
+ DatumGetPointer(OidFunctionCall4(procedure,
+ PointerGetDatum(relation),
+ BoolGetDatum(scanFromEnd),
+ UInt16GetDatum(numberOfKeys),
+ PointerGetDatum(key)));
return scandesc;
}
SCAN_CHECKS;
GET_SCAN_PROCEDURE(rescan, amrescan);
- fmgr(procedure, scan, scanFromEnd, key);
+ OidFunctionCall3(procedure,
+ PointerGetDatum(scan),
+ BoolGetDatum(scanFromEnd),
+ PointerGetDatum(key));
}
/* ----------------
SCAN_CHECKS;
GET_SCAN_PROCEDURE(endscan, amendscan);
- fmgr(procedure, scan);
+ OidFunctionCall1(procedure, PointerGetDatum(scan));
/* Release lock and refcount acquired by index_beginscan */
SCAN_CHECKS;
GET_SCAN_PROCEDURE(markpos, ammarkpos);
- fmgr(procedure, scan);
+ OidFunctionCall1(procedure, PointerGetDatum(scan));
}
/* ----------------
SCAN_CHECKS;
GET_SCAN_PROCEDURE(restrpos, amrestrpos);
- fmgr(procedure, scan);
+ OidFunctionCall1(procedure, PointerGetDatum(scan));
}
/* ----------------
* ----------------
*/
result = (RetrieveIndexResult)
- (*fmgr_faddr(&scan->fn_getnext)) (scan, direction);
+ DatumGetPointer(FunctionCall2(&scan->fn_getnext,
+ PointerGetDatum(scan),
+ Int32GetDatum(direction)));
return result;
}
return loc[(natts * (procnum - 1)) + (attnum - 1)];
}
-
-Datum
-GetIndexValue(HeapTuple tuple,
- TupleDesc hTupDesc,
- int attOff,
- AttrNumber *attrNums,
- FuncIndexInfo *fInfo,
- bool *attNull)
-{
- Datum returnVal;
-
- if (PointerIsValid(fInfo) && FIgetProcOid(fInfo) != InvalidOid)
- {
- FmgrInfo flinfo;
- FunctionCallInfoData fcinfo;
- int i;
- bool anynull = false;
-
- /*
- * XXX ought to store lookup info in FuncIndexInfo so it need not
- * be repeated on each call?
- */
- fmgr_info(FIgetProcOid(fInfo), &flinfo);
-
- MemSet(&fcinfo, 0, sizeof(fcinfo));
- fcinfo.flinfo = &flinfo;
- fcinfo.nargs = FIgetnArgs(fInfo);
-
- for (i = 0; i < FIgetnArgs(fInfo); i++)
- {
- fcinfo.arg[i] = heap_getattr(tuple,
- attrNums[i],
- hTupDesc,
- &fcinfo.argnull[i]);
- anynull |= fcinfo.argnull[i];
- }
- if (flinfo.fn_strict && anynull)
- {
- /* force a null result for strict function */
- returnVal = (Datum) 0;
- *attNull = true;
- }
- else
- {
- returnVal = FunctionCallInvoke(&fcinfo);
- *attNull = fcinfo.isnull;
- }
- }
- else
- returnVal = heap_getattr(tuple, attrNums[attOff], hTupDesc, attNull);
-
- return returnVal;
-}