本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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));
}
}
示例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));
}
示例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)));
}
示例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);
}
示例8: leftmostvalue_varbit
static Datum
leftmostvalue_varbit(void)
{
return DirectFunctionCall3(varbit_in,
CStringGetDatum(""),
ObjectIdGetDatum(0),
Int32GetDatum(-1));
}
示例9: ginqueryarrayextract
Datum
ginqueryarrayextract(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ginarrayextract,
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
示例10: leftmostvalue_inet
static Datum
leftmostvalue_inet(void)
{
return DirectFunctionCall3(inet_in,
CStringGetDatum("0.0.0.0/0"),
ObjectIdGetDatum(0),
Int32GetDatum(-1));
}
示例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)));
}
示例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)));
}
示例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);
}
示例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)));
}
示例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);
}