本文整理汇总了C++中PG_GETARG_ABSOLUTETIME函数的典型用法代码示例。如果您正苦于以下问题:C++ PG_GETARG_ABSOLUTETIME函数的具体用法?C++ PG_GETARG_ABSOLUTETIME怎么用?C++ PG_GETARG_ABSOLUTETIME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PG_GETARG_ABSOLUTETIME函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: btabstimecmp
Datum
btabstimecmp(PG_FUNCTION_ARGS)
{
AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
PG_RETURN_INT32(abstime_cmp_internal(t1, t2));
}
开发者ID:GisKook,项目名称:Gis,代码行数:8,代码来源:nabstime.c
示例2: abstimege
Datum
abstimege(PG_FUNCTION_ARGS)
{
AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
PG_RETURN_BOOL(abstime_cmp_internal(t1, t2) >= 0);
}
开发者ID:GisKook,项目名称:Gis,代码行数:8,代码来源:nabstime.c
示例3: abstime_finite
/* abstime_finite()
*/
Datum
abstime_finite(PG_FUNCTION_ARGS)
{
AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
PG_RETURN_BOOL(abstime != INVALID_ABSTIME &&
abstime != NOSTART_ABSTIME &&
abstime != NOEND_ABSTIME);
}
开发者ID:GisKook,项目名称:Gis,代码行数:11,代码来源:nabstime.c
示例4: abstimesend
/*
* abstimesend - converts abstime to binary format
*/
Datum
abstimesend(PG_FUNCTION_ARGS)
{
AbsoluteTime time = PG_GETARG_ABSOLUTETIME(0);
StringInfoData buf;
pq_begintypsend(&buf);
pq_sendint(&buf, time, sizeof(time));
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
}
开发者ID:GisKook,项目名称:Gis,代码行数:13,代码来源:nabstime.c
示例5: timemi
/*
* timemi - returns the value of (abstime t1 - reltime t2)
*/
Datum
timemi(PG_FUNCTION_ARGS)
{
AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
RelativeTime t2 = PG_GETARG_RELATIVETIME(1);
if (AbsoluteTimeIsReal(t1) &&
RelativeTimeIsValid(t2) &&
((t2 > 0 && t1 > NOSTART_ABSTIME + t2) ||
(t2 <= 0 && t1 < NOEND_ABSTIME + t2))) /* prevent overflow */
PG_RETURN_ABSOLUTETIME(t1 - t2);
PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME);
}
开发者ID:GisKook,项目名称:Gis,代码行数:17,代码来源:nabstime.c
示例6: mktinterval
/*
* mktinterval - creates a time interval with endpoints t1 and t2
*/
Datum
mktinterval(PG_FUNCTION_ARGS)
{
AbsoluteTime t1 = PG_GETARG_ABSOLUTETIME(0);
AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
AbsoluteTime tstart = ABSTIMEMIN(t1, t2);
AbsoluteTime tend = ABSTIMEMAX(t1, t2);
TimeInterval tinterval;
tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
tinterval->status = T_INTERVAL_INVAL;
else
{
tinterval->status = T_INTERVAL_VALID;
tinterval->data[0] = tstart;
tinterval->data[1] = tend;
}
PG_RETURN_TIMEINTERVAL(tinterval);
}
开发者ID:GisKook,项目名称:Gis,代码行数:26,代码来源:nabstime.c
示例7: intinterval
/*
* intinterval - returns true iff absolute date is in the tinterval
*/
Datum
intinterval(PG_FUNCTION_ARGS)
{
AbsoluteTime t = PG_GETARG_ABSOLUTETIME(0);
TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(1);
if (tinterval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME)
{
if (DatumGetBool(DirectFunctionCall2(abstimege,
AbsoluteTimeGetDatum(t),
AbsoluteTimeGetDatum(tinterval->data[0]))) &&
DatumGetBool(DirectFunctionCall2(abstimele,
AbsoluteTimeGetDatum(t),
AbsoluteTimeGetDatum(tinterval->data[1]))))
PG_RETURN_BOOL(true);
}
PG_RETURN_BOOL(false);
}
开发者ID:GisKook,项目名称:Gis,代码行数:21,代码来源:nabstime.c
示例8: abstime_timestamptz
/* abstime_timestamptz()
* Convert abstime to timestamp with time zone.
*/
Datum
abstime_timestamptz(PG_FUNCTION_ARGS)
{
AbsoluteTime abstime = PG_GETARG_ABSOLUTETIME(0);
TimestampTz result;
struct pg_tm tt,
*tm = &tt;
int tz;
char zone[MAXDATELEN + 1],
*tzn = zone;
switch (abstime)
{
case INVALID_ABSTIME:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot convert abstime \"invalid\" to timestamp"),
errOmitLocation(true)));
TIMESTAMP_NOBEGIN(result);
break;
case NOSTART_ABSTIME:
TIMESTAMP_NOBEGIN(result);
break;
case NOEND_ABSTIME:
TIMESTAMP_NOEND(result);
break;
default:
abstime2tm(abstime, &tz, tm, &tzn);
if (tm2timestamp(tm, 0, &tz, &result) != 0)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("timestamp out of range"),
errOmitLocation(true)));
break;
};
PG_RETURN_TIMESTAMP(result);
}
开发者ID:laixiong,项目名称:incubator-hawq,代码行数:44,代码来源:nabstime.c
示例9: abstimeout
/* abstimeout()
* Given an AbsoluteTime return the English text version of the date
*/
Datum
abstimeout(PG_FUNCTION_ARGS)
{
AbsoluteTime time = PG_GETARG_ABSOLUTETIME(0);
char *result;
int tz;
double fsec = 0;
struct pg_tm tt,
*tm = &tt;
char buf[MAXDATELEN + 1];
char zone[MAXDATELEN + 1],
*tzn = zone;
switch (time)
{
/*
* Note that timestamp no longer supports 'invalid'. Retain
* 'invalid' for abstime for now, but dump it someday.
*/
case INVALID_ABSTIME:
strcpy(buf, INVALID);
break;
case NOEND_ABSTIME:
strcpy(buf, LATE);
break;
case NOSTART_ABSTIME:
strcpy(buf, EARLY);
break;
default:
abstime2tm(time, &tz, tm, &tzn);
EncodeDateTime(tm, fsec, &tz, &tzn, DateStyle, buf);
break;
}
result = pstrdup(buf);
PG_RETURN_CSTRING(result);
}
开发者ID:GisKook,项目名称:Gis,代码行数:40,代码来源:nabstime.c
注:本文中的PG_GETARG_ABSOLUTETIME函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论