本文整理汇总了C++中PG_RETURN_VOID函数的典型用法代码示例。如果您正苦于以下问题:C++ PG_RETURN_VOID函数的具体用法?C++ PG_RETURN_VOID怎么用?C++ PG_RETURN_VOID使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PG_RETURN_VOID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: regress_putenv
Datum
regress_putenv(PG_FUNCTION_ARGS)
{
MemoryContext oldcontext;
char *envbuf;
if (!superuser())
elog(ERROR, "must be superuser to change environment variables");
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
envbuf = text_to_cstring((text *) PG_GETARG_POINTER(0));
MemoryContextSwitchTo(oldcontext);
if (putenv(envbuf) != 0)
elog(ERROR, "could not set environment variable: %m");
PG_RETURN_VOID();
}
示例2: ginendscan
Datum
ginendscan(PG_FUNCTION_ARGS)
{
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
GinScanOpaque so = (GinScanOpaque) scan->opaque;
if (so != NULL)
{
freeScanKeys(so->keys, so->nkeys, TRUE);
freeScanKeys(so->markPos, so->nkeys, FALSE);
MemoryContextDelete(so->tempCtx);
pfree(so);
}
PG_RETURN_VOID();
}
示例3: quicklz_compress
/* ---------------------------------------------------------------------
* SQL invokable compression and decompression routines for built in
* compression algorithms. All routines have the same SQL signature:
*
* void fun(internal, int, internal, int, internal, internal)
*
* If we were to think of this as a C function it would be more like:
*
* void fun(void *src, size_t src_sz, void *dst, size_t dst_sz,
* size_t *dst_used, void *opaque)
*
* The meaning of each argument is as follows:
* src - A pointer to data to be compressed/decompressed
* src_sz - The number of bytes to compress/decompress
* dst - A pointer to pre-allocated memory. The data compressed or
* decompressed by the function are written here.
* dst_sz - The amount of memory in bytes allocated at dst
* dst_used - The number of bytes written. If dst_sz was too small to
* store the data, this is set to zero.
* opaque - Internal to the compression function.
*/
Datum
quicklz_compress(PG_FUNCTION_ARGS)
{
const void *src = PG_GETARG_POINTER(0);
int32 src_sz = PG_GETARG_INT32(1);
void *dst = PG_GETARG_POINTER(2);
int32 dst_sz = PG_GETARG_INT32(3);
int32 *dst_used = (int32 *) PG_GETARG_POINTER(4);
CompressionState *cs = (CompressionState *)PG_GETARG_POINTER(5);
quicklz_state *state = (quicklz_state *)cs->opaque;
Insist(dst_sz >= quicklz_desired_sz(src_sz));
*dst_used = state->compress_fn(state->level, src, dst, (size_t)src_sz,
state->scratch);
PG_RETURN_VOID();
}
示例4: win866_to_iso
Datum
win866_to_iso(PG_FUNCTION_ARGS)
{
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4);
unsigned char *buf;
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN866, PG_ISO_8859_5);
/* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */
buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win8662mic(src, buf, len);
mic2iso(buf, dest, strlen((char *) buf));
pfree(buf);
PG_RETURN_VOID();
}
示例5: pg_xlog_replay_resume
/*
* pg_xlog_replay_resume - resume recovery now
*/
Datum
pg_xlog_replay_resume(PG_FUNCTION_ARGS)
{
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to control recovery"))));
if (!RecoveryInProgress())
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("recovery is not in progress"),
errhint("Recovery control functions can only be executed during recovery.")));
SetRecoveryPause(false);
PG_RETURN_VOID();
}
示例6: worker_apply_shard_ddl_command
/*
* worker_apply_shard_ddl_command extends table, index, or constraint names in
* the given DDL command. The function then applies this extended DDL command
* against the database.
*/
Datum
worker_apply_shard_ddl_command(PG_FUNCTION_ARGS)
{
uint64 shardId = PG_GETARG_INT64(0);
text *schemaNameText = PG_GETARG_TEXT_P(1);
text *ddlCommandText = PG_GETARG_TEXT_P(2);
char *schemaName = text_to_cstring(schemaNameText);
const char *ddlCommand = text_to_cstring(ddlCommandText);
Node *ddlCommandNode = ParseTreeNode(ddlCommand);
/* extend names in ddl command and apply extended command */
RelayEventExtendNames(ddlCommandNode, schemaName, shardId);
ProcessUtility(ddlCommandNode, ddlCommand, PROCESS_UTILITY_TOPLEVEL,
NULL, None_Receiver, NULL);
PG_RETURN_VOID();
}
示例7: tsm_system_time_reset
/*
* Reset state (called by ReScan).
*/
Datum
tsm_system_time_reset(PG_FUNCTION_ARGS)
{
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
SystemSamplerData *sampler = (SystemSamplerData *) tsdesc->tsmdata;
sampler->lt = InvalidOffsetNumber;
sampler->start_time = GetCurrentTimestamp();
sampler->end_time = TimestampTzPlusMilliseconds(sampler->start_time,
sampler->time);
sampler->estblocks = 2;
sampler->doneblocks = 0;
sampler_random_init_state(sampler->seed, sampler->randstate);
sampler->step = random_relative_prime(sampler->nblocks, sampler->randstate);
sampler->lb = sampler_random_fract(sampler->randstate) * (sampler->nblocks / sampler->step);
PG_RETURN_VOID();
}
示例8: big5_to_euc_tw
Datum
big5_to_euc_tw(PG_FUNCTION_ARGS)
{
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4);
unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_BIG5);
Assert(PG_GETARG_INT32(1) == PG_EUC_TW);
Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE);
big52mic(src, buf, len);
mic2euc_tw(buf, dest, strlen((char *) buf));
pfree(buf);
PG_RETURN_VOID();
}
示例9: win1251_to_koi8r
Datum
win1251_to_koi8r(PG_FUNCTION_ARGS)
{
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4);
unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_WIN1251);
Assert(PG_GETARG_INT32(1) == PG_KOI8R);
Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE);
win12512mic(src, buf, len);
mic2koi8r(buf, dest, strlen((char *) buf));
pfree(buf);
PG_RETURN_VOID();
}
示例10: plvdate_unset_nonbizday_day
Datum
plvdate_unset_nonbizday_day (PG_FUNCTION_ARGS)
{
DateADT arg1 = PG_GETARG_DATEADT(0);
bool arg2 = PG_GETARG_BOOL(1);
int y, m, d;
bool found = false;
int i;
if (arg2)
{
j2date(arg1 + POSTGRES_EPOCH_JDATE, &y, &m, &d);
for (i = 0; i < holidays_c; i++)
{
if (!found && holidays[i].month == m && holidays[i].day == d)
found = true;
else if (found)
{
holidays[i-1].month = holidays[i].month;
holidays[i-1].day = holidays[i].day;
}
}
if (found)
holidays_c -= 1;
}
else
{
for (i = 0; i < exceptions_c; i++)
if (!found && exceptions[i] == arg1)
found = true;
else if (found)
exceptions[i-1] = exceptions[i];
if (found)
exceptions_c -= 1;
}
if (!found)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("nonbizday unregisteration error"),
errdetail("Nonbizday not found.")));
PG_RETURN_VOID();
}
示例11: lo_put
/*
* Update range within LO
*/
Datum
lo_put(PG_FUNCTION_ARGS)
{
Oid loOid = PG_GETARG_OID(0);
int64 offset = PG_GETARG_INT64(1);
bytea *str = PG_GETARG_BYTEA_PP(2);
LargeObjectDesc *loDesc;
int written PG_USED_FOR_ASSERTS_ONLY;
CreateFSContext();
loDesc = inv_open(loOid, INV_WRITE, fscxt);
inv_seek(loDesc, offset, SEEK_SET);
written = inv_write(loDesc, VARDATA_ANY(str), VARSIZE_ANY_EXHDR(str));
Assert(written == VARSIZE_ANY_EXHDR(str));
inv_close(loDesc);
PG_RETURN_VOID();
}
示例12: wait_pid
Datum
wait_pid(PG_FUNCTION_ARGS)
{
int pid = PG_GETARG_INT32(0);
if (!superuser())
elog(ERROR, "must be superuser to check PID liveness");
while (kill(pid, 0) == 0)
{
CHECK_FOR_INTERRUPTS();
pg_usleep(50000);
}
if (errno != ESRCH)
elog(ERROR, "could not check PID %d liveness: %m", pid);
PG_RETURN_VOID();
}
示例13: win866_to_iso
Datum
win866_to_iso(PG_FUNCTION_ARGS)
{
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4);
unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_WIN866);
Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE);
win8662mic(src, buf, len);
mic2iso(buf, dest, strlen((char *) buf));
pfree(buf);
PG_RETURN_VOID();
}
示例14: pg_sleep
/*
* pg_sleep - delay for N seconds
*/
Datum
pg_sleep(PG_FUNCTION_ARGS)
{
float8 secs = PG_GETARG_FLOAT8(0);
float8 endtime;
/*
* We break the requested sleep into segments of no more than 1 second, to
* put an upper bound on how long it will take us to respond to a cancel
* or die interrupt. (Note that pg_usleep is interruptible by signals on
* some platforms but not others.) Also, this method avoids exposing
* pg_usleep's upper bound on allowed delays.
*
* By computing the intended stop time initially, we avoid accumulation of
* extra delay across multiple sleeps. This also ensures we won't delay
* less than the specified time if pg_usleep is interrupted by other
* signals such as SIGHUP.
*/
#ifdef HAVE_INT64_TIMESTAMP
#define GetNowFloat() ((float8) GetCurrentTimestamp() / 1000000.0)
#else
#define GetNowFloat() GetCurrentTimestamp()
#endif
endtime = GetNowFloat() + secs;
for (;;)
{
float8 delay;
CHECK_FOR_INTERRUPTS();
delay = endtime - GetNowFloat();
if (delay >= 1.0)
pg_usleep(1000000L);
else if (delay > 0.0)
pg_usleep((long) ceil(delay * 1000000.0));
else
break;
}
PG_RETURN_VOID();
}
示例15: cassandra_fdw_validator
Datum
cassandra_fdw_validator(PG_FUNCTION_ARGS)
{
List *options_list = untransformRelOptions(PG_GETARG_DATUM(0));
elog(DEBUG1,"entering function %s",__func__);
/* make sure the options are valid */
/* no options are supported */
if (list_length(options_list) > 0)
ereport(ERROR,
(errcode(ERRCODE_FDW_INVALID_OPTION_NAME),
errmsg("invalid options"),
errhint("Cassandra FDW doies not support any options")));
PG_RETURN_VOID();
}