Exemplo n.º 1
0
Arquivo: tsearch2.c Projeto: 50wu/gpdb
/* headline(text, text, tsquery [,text]) */
Datum
tsa_headline_byname(PG_FUNCTION_ARGS)
{
	Datum		arg0 = PG_GETARG_DATUM(0);
	Datum		arg1 = PG_GETARG_DATUM(1);
	Datum		arg2 = PG_GETARG_DATUM(2);
	Datum		result;
	Oid			config_oid;

	/* first parameter has to be converted to oid */
	config_oid = DatumGetObjectId(DirectFunctionCall1(regconfigin,
										DirectFunctionCall1(textout, arg0)));

	if (PG_NARGS() == 3)
		result = DirectFunctionCall3(ts_headline_byid,
								   ObjectIdGetDatum(config_oid), arg1, arg2);
	else
	{
		Datum		arg3 = PG_GETARG_DATUM(3);

		result = DirectFunctionCall4(ts_headline_byid_opt,
									 ObjectIdGetDatum(config_oid),
									 arg1, arg2, arg3);
	}

	return result;
}
Exemplo n.º 2
0
Datum
ts_headline_opt(PG_FUNCTION_ARGS)
{
	PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_byid_opt,
								  ObjectIdGetDatum(getTSCurrentConfig(true)),
										PG_GETARG_DATUM(0),
										PG_GETARG_DATUM(1),
										PG_GETARG_DATUM(2)));
}
Exemplo n.º 3
0
Datum
_int_contained_sel(PG_FUNCTION_ARGS)
{
    PG_RETURN_DATUM(DirectFunctionCall4(arraycontsel,
                                        PG_GETARG_DATUM(0),
                                        ObjectIdGetDatum(OID_ARRAY_CONTAINED_OP),
                                        PG_GETARG_DATUM(2),
                                        PG_GETARG_DATUM(3)));
}
Exemplo n.º 4
0
Datum
_int_overlap_sel(PG_FUNCTION_ARGS)
{
    PG_RETURN_DATUM(DirectFunctionCall4(arraycontsel,
                                        PG_GETARG_DATUM(0),
                                        ObjectIdGetDatum(OID_ARRAY_OVERLAP_OP),
                                        PG_GETARG_DATUM(2),
                                        PG_GETARG_DATUM(3)));
}
Exemplo n.º 5
0
Datum
_int_contains_sel(MDB_FUNCTION_ARGS)
{
	MDB_RETURN_DATUM(DirectFunctionCall4(arraycontsel,
										MDB_GETARG_DATUM(0),
									 ObjectIdGetDatum(OID_ARRAY_CONTAINS_OP),
										MDB_GETARG_DATUM(2),
										MDB_GETARG_DATUM(3)));
}
Exemplo n.º 6
0
Datum LWGEOM_distance_sphere(PG_FUNCTION_ARGS)
{
	SPHEROID s;

	/* Init to WGS84 */
	spheroid_init(&s, 6378137.0, 6356752.314245179498);
	s.a = s.b = s.radius;

	PG_RETURN_DATUM(DirectFunctionCall4(geometry_distance_spheroid,
	                                    PG_GETARG_DATUM(0), PG_GETARG_DATUM(1), PointerGetDatum(&s), BoolGetDatum(FALSE)));
}
Exemplo n.º 7
0
Datum
headline_current(PG_FUNCTION_ARGS)
{
	SET_FUNCOID();
	PG_RETURN_DATUM(DirectFunctionCall4(
										headline,
										ObjectIdGetDatum(get_currcfg()),
										PG_GETARG_DATUM(0),
										PG_GETARG_DATUM(1),
				(PG_NARGS() > 2) ? PG_GETARG_DATUM(2) : PointerGetDatum(NULL)
										));
}
Exemplo n.º 8
0
Datum
headline_byname(PG_FUNCTION_ARGS)
{
	text	   *cfg = PG_GETARG_TEXT_P(0);

	Datum		out;

	SET_FUNCOID();
	out = DirectFunctionCall4(
							  headline,
							  ObjectIdGetDatum(name2id_cfg(cfg)),
							  PG_GETARG_DATUM(1),
							  PG_GETARG_DATUM(2),
				(PG_NARGS() > 3) ? PG_GETARG_DATUM(3) : PointerGetDatum(NULL)
		);

	PG_FREE_IF_COPY(cfg, 0);
	PG_RETURN_DATUM(out);
}
Exemplo n.º 9
0
Datum LWGEOM_distance_ellipsoid(PG_FUNCTION_ARGS)
{
	PG_RETURN_DATUM(DirectFunctionCall4(geometry_distance_spheroid,
	                                    PG_GETARG_DATUM(0), PG_GETARG_DATUM(1), PG_GETARG_DATUM(2), BoolGetDatum(TRUE)));
}