예제 #1
0
파일: wciReadFloat.c 프로젝트: helenk/wdb
/**
 * Create and run the basic query on the gridvalue table, for use by the wciReadFloat function
 */
static void runWciReadFloatQueryGrid(struct ReadStore * out, FuncCallContext * funcctx, FunctionCallInfo fcinfo)
{
	initializeGeos();

	struct WciReadParameterCollection p;
	parseReadParameters(& p, fcinfo);
	const char * whatToSelect = "value, dataprovidername, placename::text, placegeometry, referencetime, validtimefrom, validtimeto, validtimeindeterminatecode, valueparametername, valueunitname, levelparametername, levelunitname, levelfrom, levelto, levelindeterminatecode, dataversion, confidencecode, valuestoretime, valueid, valuetype, placeid";
	const char * gridQuery = build_query(& p, GridTable, OutputFloat, whatToSelect, NULL);
	elog(DEBUG1, gridQuery);

	// Perform primary query
	SPIPlanPtr queryPlan = getSpiPlan(gridQuery);
	if (SPI_OK_SELECT != SPI_execute_plan(queryPlan, NULL, NULL, true, 0))
	{
		ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg(
				"Error when performing base query")));
	}
	MemoryContext oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);


	if ( PG_ARGISNULL(1) )
	{
		ReadStoreGridReturnInit(out, SPI_tuptable, SPI_processed, NULL);
	}
	else
	{
		text * location_t = PG_GETARG_TEXT_P(1);
		const char * location = TextPGetCString(location_t);
		ReadStoreGridReturnInit(out, SPI_tuptable, SPI_processed, location);
	}
	MemoryContextSwitchTo(oldcontext);
}
예제 #2
0
파일: tsearch2.c 프로젝트: 50wu/gpdb
/* 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();
}
예제 #3
0
파일: tsearch2.c 프로젝트: 50wu/gpdb
/* set_curdict(text) */
Datum
tsa_set_curdict_byname(PG_FUNCTION_ARGS)
{
	text	   *name = PG_GETARG_TEXT_P(0);
	Oid			dict_oid;

	dict_oid = TSDictionaryGetDictid(stringToQualifiedNameList(TextPGetCString(name)), false);

	current_dictionary_oid = dict_oid;

	PG_RETURN_VOID();
}
예제 #4
0
파일: tsearch2.c 프로젝트: 50wu/gpdb
/* set_curcfg(text) */
Datum
tsa_set_curcfg_byname(PG_FUNCTION_ARGS)
{
	text	   *arg0 = PG_GETARG_TEXT_P(0);
	char	   *name;

	name = TextPGetCString(arg0);

	set_config_option("default_text_search_config", name,
					  PGC_USERSET,
					  PGC_S_SESSION,
					  GUC_ACTION_SET,
					  true);

	PG_RETURN_VOID();
}