MCPcopy Create free account
hub / github.com/apache/cloudberry / assert_equals_base

Function assert_equals_base

gpcontrib/orafce/plunit.c:222–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221
222static bool
223assert_equals_base(FunctionCallInfo fcinfo)
224{
225 Datum value1 = PG_GETARG_DATUM(0);
226 Datum value2 = PG_GETARG_DATUM(1);
227 Oid *ptr;
228
229 ptr = (Oid *) fcinfo->flinfo->fn_extra;
230 if (ptr == NULL)
231 {
232 Oid valtype = get_fn_expr_argtype(fcinfo->flinfo, 0);
233 Oid eqopfcid;
234
235 if (!OidIsValid(valtype))
236 elog(ERROR, "could not determine data type of input");
237
238 eqopfcid = equality_oper_funcid(valtype);
239
240 if (!OidIsValid(eqopfcid))
241 ereport(ERROR,
242 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
243 errmsg("unknown equal operand for datatype")));
244
245 /* First time calling for current query: allocate storage */
246 fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
247 sizeof(Oid));
248 ptr = (Oid *) fcinfo->flinfo->fn_extra;
249 *ptr = eqopfcid;
250 }
251
252 return DatumGetBool(OidFunctionCall2Coll(*ptr, DEFAULT_COLLATION_OID, value1, value2));
253}
254
255Datum
256plunit_assert_equals(PG_FUNCTION_ARGS)

Callers 2

Calls 7

get_fn_expr_argtypeFunction · 0.85
equality_oper_funcidFunction · 0.85
MemoryContextAllocFunction · 0.85
DatumGetBoolFunction · 0.85
OidFunctionCall2CollFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected