当前位置: 首页>>代码示例>>C++>>正文


C++ DirectFunctionCall3函数代码示例

本文整理汇总了C++中DirectFunctionCall3函数的典型用法代码示例。如果您正苦于以下问题:C++ DirectFunctionCall3函数的具体用法?C++ DirectFunctionCall3怎么用?C++ DirectFunctionCall3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DirectFunctionCall3函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tsa_headline_byname

/* 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;
}
开发者ID:50wu,项目名称:gpdb,代码行数:28,代码来源:tsearch2.c

示例2: ora_to_date

Datum
ora_to_date(PG_FUNCTION_ARGS)
{
	text *date_txt = PG_GETARG_TEXT_PP(0);
	Timestamp result;

	if(nls_date_format && strlen(nls_date_format))
	{
		Datum newDate;

		/* it will return timestamp at GMT */
		newDate = DirectFunctionCall2(to_timestamp,
							CStringGetDatum(date_txt),
							CStringGetDatum(cstring_to_text(nls_date_format)));

		/* convert to local timestamp */
		result = DatumGetTimestamp(DirectFunctionCall1(timestamptz_timestamp, newDate));
	}
	else
		result = DatumGetTimestamp(DirectFunctionCall3(timestamp_in,
									CStringGetDatum(text_to_cstring(date_txt)),
									ObjectIdGetDatum(InvalidOid),
									Int32GetDatum(-1)));

	PG_RETURN_TIMESTAMP(result);
}
开发者ID:vinpokale,项目名称:orafce,代码行数:26,代码来源:datefce.c

示例3: g_int_consistent

/*
** The GiST Consistent method for _intments
** Should return false if for all data items x below entry,
** the predicate x op query == FALSE, where op is the oper
** corresponding to strategy in the pg_amop table.
*/
Datum
g_int_consistent(PG_FUNCTION_ARGS)
{
	GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
	ArrayType  *query = (ArrayType *) PG_DETOAST_DATUM_COPY(PG_GETARG_POINTER(1));
	StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
	bool		retval;

	if (strategy == BooleanSearchStrategy) {
		 retval =execconsistent((QUERYTYPE *) query,
							   (ArrayType *) DatumGetPointer(entry->key),
				  ISLEAFKEY((ArrayType *) DatumGetPointer(entry->key)));
		pfree( query );

		PG_RETURN_BOOL(retval);
	}

	/* sort query for fast search, key is already sorted */
	if (ARRISVOID(query)) {
		pfree( query );
		PG_RETURN_BOOL(false);
	}
	PREPAREARR(query);

	switch (strategy)
	{
		case RTOverlapStrategyNumber:
			retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
									   query);
			break;
		case RTSameStrategyNumber:
			if (GIST_LEAF(entry))
				DirectFunctionCall3(
									g_int_same,
									entry->key,
									PointerGetDatum(query),
									PointerGetDatum(&retval)
					);
			else
				retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
											query);
			break;
		case RTContainsStrategyNumber:
			retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
										query);
			break;
		case RTContainedByStrategyNumber:
			if (GIST_LEAF(entry))
				retval = inner_int_contains(query,
							  (ArrayType *) DatumGetPointer(entry->key));
			else
				retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
										   query);
			break;
		default:
			retval = FALSE;
	}
	pfree( query );
	PG_RETURN_BOOL(retval);
}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:66,代码来源:_int_gist.c

示例4: build_regexp_split_result

/*
 * build_regexp_split_result - build output string for current match
 *
 * We return the string between the current match and the previous one,
 * or the string after the last match when next_match == nmatches.
 */
static Datum
build_regexp_split_result(regexp_matches_ctx *splitctx)
{
	int			startpos;
	int			endpos;

	if (splitctx->next_match > 0)
		startpos = splitctx->match_locs[splitctx->next_match * 2 - 1];
	else
		startpos = 0;
	if (startpos < 0)
		elog(ERROR, "invalid match ending position");

	if (splitctx->next_match < splitctx->nmatches)
	{
		endpos = splitctx->match_locs[splitctx->next_match * 2];
		if (endpos < startpos)
			elog(ERROR, "invalid match starting position");
		return DirectFunctionCall3(text_substr,
								   PointerGetDatum(splitctx->orig_str),
								   Int32GetDatum(startpos + 1),
								   Int32GetDatum(endpos - startpos));
	}
	else
	{
		/* no more matches, return rest of string */
		return DirectFunctionCall2(text_substr_no_len,
								   PointerGetDatum(splitctx->orig_str),
								   Int32GetDatum(startpos + 1));
	}
}
开发者ID:BioBD,项目名称:Hypothetical_Indexes,代码行数:37,代码来源:regexp.c

示例5: ST_LocateBetween

Datum ST_LocateBetween(PG_FUNCTION_ARGS)
{
	GSERIALIZED *geom_in = PG_GETARG_GSERIALIZED_P(0);
	double from = PG_GETARG_FLOAT8(1);
	double to = PG_GETARG_FLOAT8(2);
	double offset = PG_GETARG_FLOAT8(3);
	LWCOLLECTION *geom_out = NULL;
	LWGEOM *line_in = NULL;
	static char ordinate = 'M'; /* M */

	if ( ! gserialized_has_m(geom_in) )
	{
		elog(ERROR,"This function only accepts geometries that have an M dimension.");
		PG_RETURN_NULL();
	}

	/* This should be a call to ST_LocateAlong! */
	if ( to == from )
	{
		PG_RETURN_DATUM(DirectFunctionCall3(ST_LocateAlong, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1), PG_GETARG_DATUM(3)));
	}

	line_in = lwgeom_from_gserialized(geom_in);
	geom_out = lwgeom_clip_to_ordinate_range(line_in,  ordinate, from, to, offset);	
	lwgeom_free(line_in);
	PG_FREE_IF_COPY(geom_in, 0);

	if ( ! geom_out )
	{
		elog(ERROR,"lwline_clip_to_ordinate_range returned null");
		PG_RETURN_NULL();
	}

	PG_RETURN_POINTER(geometry_serialize((LWGEOM*)geom_out));
}
开发者ID:dengxuyue,项目名称:postgresql,代码行数:35,代码来源:lwgeom_functions_lrs.c

示例6: ora_substr

/*
 * len < 0 means "length is not specified".
 */
static text *
ora_substr(Datum str, int start, int len)
{
	if (start == 0)
		start = 1;	/* 0 is interpreted as 1 */
	else if (start < 0)
	{
		text   *t;
		int32	n;

		t = DatumGetTextPP(str);
		n = pg_mbstrlen_with_len(VARDATA_ANY(t), VARSIZE_ANY_EXHDR(t));
		start = n + start + 1;
		if (start <= 0)
			return cstring_to_text("");
		str = PointerGetDatum(t);	/* save detoasted text */
	}

	if (len < 0)
		return DatumGetTextP(DirectFunctionCall2(text_substr_no_len,
			str, Int32GetDatum(start)));
	else
		return DatumGetTextP(DirectFunctionCall3(text_substr,
			str, Int32GetDatum(start), Int32GetDatum(len)));
}
开发者ID:protodef,项目名称:orafce,代码行数:28,代码来源:plvstr.c

示例7: pg_backup_start_time

/*
 * Returns start time of an online exclusive backup.
 *
 * When there's no exclusive backup in progress, the function
 * returns NULL.
 */
Datum
pg_backup_start_time(PG_FUNCTION_ARGS)
{
	Datum		xtime;
	FILE	   *lfp;
	char		fline[MAXPGPATH];
	char		backup_start_time[30];

	/*
	 * See if label file is present
	 */
	lfp = AllocateFile(BACKUP_LABEL_FILE, "r");
	if (lfp == NULL)
	{
		if (errno != ENOENT)
			ereport(ERROR,
					(errcode_for_file_access(),
					 errmsg("could not read file \"%s\": %m",
							BACKUP_LABEL_FILE)));
		PG_RETURN_NULL();
	}

	/*
	 * Parse the file to find the START TIME line.
	 */
	backup_start_time[0] = '\0';
	while (fgets(fline, sizeof(fline), lfp) != NULL)
	{
		if (sscanf(fline, "START TIME: %25[^\n]\n", backup_start_time) == 1)
			break;
	}

	/* Check for a read error. */
	if (ferror(lfp))
		ereport(ERROR,
				(errcode_for_file_access(),
			   errmsg("could not read file \"%s\": %m", BACKUP_LABEL_FILE)));

	/* Close the backup label file. */
	if (FreeFile(lfp))
		ereport(ERROR,
				(errcode_for_file_access(),
			  errmsg("could not close file \"%s\": %m", BACKUP_LABEL_FILE)));

	if (strlen(backup_start_time) == 0)
		ereport(ERROR,
				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
				 errmsg("invalid data in file \"%s\"", BACKUP_LABEL_FILE)));

	/*
	 * Convert the time string read from file to TimestampTz form.
	 */
	xtime = DirectFunctionCall3(timestamptz_in,
								CStringGetDatum(backup_start_time),
								ObjectIdGetDatum(InvalidOid),
								Int32GetDatum(-1));

	PG_RETURN_DATUM(xtime);
}
开发者ID:Gordiychuk,项目名称:postgres,代码行数:65,代码来源:xlogfuncs.c

示例8: leftmostvalue_varbit

static Datum
leftmostvalue_varbit(void)
{
	return DirectFunctionCall3(varbit_in,
							   CStringGetDatum(""),
							   ObjectIdGetDatum(0),
							   Int32GetDatum(-1));
}
开发者ID:Marketcircle,项目名称:postgres,代码行数:8,代码来源:btree_gin.c

示例9: ginqueryarrayextract

Datum
ginqueryarrayextract(PG_FUNCTION_ARGS)
{
	PG_RETURN_DATUM(DirectFunctionCall3(ginarrayextract,
										PG_GETARG_DATUM(0),
										PG_GETARG_DATUM(1),
										PG_GETARG_DATUM(2)));
}
开发者ID:adunstan,项目名称:pg-cvs-mirror,代码行数:8,代码来源:ginarrayproc.c

示例10: leftmostvalue_inet

static Datum
leftmostvalue_inet(void)
{
	return DirectFunctionCall3(inet_in,
							   CStringGetDatum("0.0.0.0/0"),
							   ObjectIdGetDatum(0),
							   Int32GetDatum(-1));
}
开发者ID:42penguins,项目名称:postgres,代码行数:8,代码来源:btree_gin.c

示例11: ts_headline_byid

Datum
ts_headline_byid(PG_FUNCTION_ARGS)
{
	PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt,
										PG_GETARG_DATUM(0),
										PG_GETARG_DATUM(1),
										PG_GETARG_DATUM(2)));
}
开发者ID:AllenDou,项目名称:postgresql,代码行数:8,代码来源:wparser.c

示例12: ts_headline

Datum
ts_headline(PG_FUNCTION_ARGS)
{
	PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt,
								  ObjectIdGetDatum(getTSCurrentConfig(true)),
										PG_GETARG_DATUM(0),
										PG_GETARG_DATUM(1)));
}
开发者ID:AllenDou,项目名称:postgresql,代码行数:8,代码来源:wparser.c

示例13: spheretrans_from_float8_and_type

Datum
spheretrans_from_float8_and_type(PG_FUNCTION_ARGS)
{
	SEuler	   *se;
	Datum		d[3];
	int			i;
	char	   *c = PG_GETARG_CSTRING(3);
	unsigned char t = 0;

	d[0] = PG_GETARG_DATUM(0);
	d[1] = PG_GETARG_DATUM(1);
	d[2] = PG_GETARG_DATUM(2);
	se = (SEuler *) DatumGetPointer(
						DirectFunctionCall3(spheretrans_from_float8,
											d[0], d[1], d[2]));

	for (i = 0; i < 3; i++)
	{
		switch (c[i])
		{
			case 'x':
			case 'X':
				t = EULER_AXIS_X;
				break;
			case 'y':
			case 'Y':
				t = EULER_AXIS_Y;
				break;
			case 'z':
			case 'Z':
				t = EULER_AXIS_Z;
				break;
			default:
				t = 0;
		}

		if (t == 0)
		{
			pfree(se);
			elog(ERROR, "invalid axis format");
		}
		switch (i)
		{
			case 0:
				se->phi_a = t;
				break;
			case 1:
				se->theta_a = t;
				break;
			case 2:
				se->psi_a = t;
				break;
		}
	}
	PG_RETURN_POINTER(se);

}
开发者ID:akorotkov,项目名称:pgsphere,代码行数:57,代码来源:euler.c

示例14: tsquery_phrase

Datum
tsquery_phrase(PG_FUNCTION_ARGS)
{
	PG_RETURN_POINTER(DirectFunctionCall3(
										  tsquery_phrase_distance,
										  PG_GETARG_DATUM(0),
										  PG_GETARG_DATUM(1),
										  Int32GetDatum(1)));
}
开发者ID:winlibs,项目名称:postgresql,代码行数:9,代码来源:tsquery_op.c

示例15: g_int_consistent

/*
** The GiST Consistent method for _intments
** Should return false if for all data items x below entry,
** the predicate x op query == FALSE, where op is the oper
** corresponding to strategy in the pg_amop table.
*/
Datum
g_int_consistent(PG_FUNCTION_ARGS)
{
    GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
    ArrayType  *query = (ArrayType *) PG_GETARG_POINTER(1);
    StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
    bool		retval;

    if (strategy == BooleanSearchStrategy)
        PG_RETURN_BOOL(execconsistent((QUERYTYPE *) query,
                                      (ArrayType *) DatumGetPointer(entry->key),
                                      ISLEAFKEY((ArrayType *) DatumGetPointer(entry->key))));

    /* XXX are we sure it's safe to scribble on the query object here? */
    /* XXX what about toasted input? */
    /* sort query for fast search, key is already sorted */
    if (ARRISVOID(query))
        PG_RETURN_BOOL(false);
    PREPAREARR(query);

    switch (strategy)
    {
    case RTOverlapStrategyNumber:
        retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
                                   query);
        break;
    case RTSameStrategyNumber:
        if (GIST_LEAF(entry))
            DirectFunctionCall3(
                g_int_same,
                entry->key,
                PointerGetDatum(query),
                PointerGetDatum(&retval)
            );
        else
            retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
                                        query);
        break;
    case RTContainsStrategyNumber:
        retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
                                    query);
        break;
    case RTContainedByStrategyNumber:
        if (GIST_LEAF(entry))
            retval = inner_int_contains(query,
                                        (ArrayType *) DatumGetPointer(entry->key));
        else
            retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
                                       query);
        break;
    default:
        retval = FALSE;
    }
    PG_RETURN_BOOL(retval);
}
开发者ID:shubham2094,项目名称:postgresql_8.1,代码行数:61,代码来源:_int_gist.c


注:本文中的DirectFunctionCall3函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。