Exemple #1
0
/*
 * Get Oid of current parser
 *
 * Here, it seems reasonable to select the "default" parser if none has been
 * set.
 */
static Oid
GetCurrentParser(void)
{
	if (current_parser_oid == InvalidOid)
		current_parser_oid = TSParserGetPrsid(stringToQualifiedNameList("pg_catalog.default"), false);
	return current_parser_oid;
}
Exemple #2
0
/* set_curprs(text) */
Datum
tsa_set_curprs_byname(PG_FUNCTION_ARGS)
{
	text	   *name = PG_GETARG_TEXT_P(0);
	Oid			parser_oid;

	parser_oid = TSParserGetPrsid(stringToQualifiedNameList(TextPGetCString(name)), false);

	current_parser_oid = parser_oid;

	PG_RETURN_VOID();
}
Exemple #3
0
Datum
ts_token_type_byname(PG_FUNCTION_ARGS)
{
	FuncCallContext *funcctx;
	Datum		result;

	if (SRF_IS_FIRSTCALL())
	{
		text	   *prsname = PG_GETARG_TEXT_P(0);
		Oid			prsId;

		funcctx = SRF_FIRSTCALL_INIT();
		prsId = TSParserGetPrsid(textToQualifiedNameList(prsname), false);
		tt_setup_firstcall(funcctx, prsId);
	}

	funcctx = SRF_PERCALL_SETUP();

	if ((result = tt_process_call(funcctx)) != (Datum) 0)
		SRF_RETURN_NEXT(funcctx, result);
	SRF_RETURN_DONE(funcctx);
}