本文整理汇总了C++中VARSIZE_ANY_EXHDR函数的典型用法代码示例。如果您正苦于以下问题:C++ VARSIZE_ANY_EXHDR函数的具体用法?C++ VARSIZE_ANY_EXHDR怎么用?C++ VARSIZE_ANY_EXHDR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VARSIZE_ANY_EXHDR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: textnlike
Datum
textnlike(PG_FUNCTION_ARGS)
{
text *str = PG_GETARG_TEXT_PP(0);
text *pat = PG_GETARG_TEXT_PP(1);
bool result;
char *s,
*p;
int slen,
plen;
s = VARDATA_ANY(str);
slen = VARSIZE_ANY_EXHDR(str);
p = VARDATA_ANY(pat);
plen = VARSIZE_ANY_EXHDR(pat);
result = (GenericMatchText(s, slen, p, plen) != LIKE_TRUE);
PG_RETURN_BOOL(result);
}
示例2: byteanlike
Datum
byteanlike(PG_FUNCTION_ARGS)
{
bytea *str = PG_GETARG_BYTEA_PP(0);
bytea *pat = PG_GETARG_BYTEA_PP(1);
bool result;
char *s,
*p;
int slen,
plen;
s = VARDATA_ANY(str);
slen = VARSIZE_ANY_EXHDR(str);
p = VARDATA_ANY(pat);
plen = VARSIZE_ANY_EXHDR(pat);
result = (SB_MatchText(s, slen, p, plen) != LIKE_TRUE);
PG_RETURN_BOOL(result);
}
示例3: pg_file_write
Datum
pg_file_write(PG_FUNCTION_ARGS)
{
FILE *f;
char *filename;
text *data;
int64 count = 0;
requireSuperuser();
filename = convert_and_check_filename(PG_GETARG_TEXT_PP(0), false);
data = PG_GETARG_TEXT_PP(1);
if (!PG_GETARG_BOOL(2))
{
struct stat fst;
if (stat(filename, &fst) >= 0)
ereport(ERROR,
(ERRCODE_DUPLICATE_FILE,
errmsg("file \"%s\" exists", filename)));
f = AllocateFile(filename, "wb");
}
else
f = AllocateFile(filename, "ab");
if (!f)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not open file \"%s\" for writing: %m",
filename)));
count = fwrite(VARDATA_ANY(data), 1, VARSIZE_ANY_EXHDR(data), f);
if (count != VARSIZE_ANY_EXHDR(data) || FreeFile(f))
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not write file \"%s\": %m", filename)));
PG_RETURN_INT64(count);
}
示例4: plvdate_unset_nonbizday_dow
Datum
plvdate_unset_nonbizday_dow (PG_FUNCTION_ARGS)
{
text *day_txt = PG_GETARG_TEXT_PP(0);
int d = ora_seq_search(VARDATA_ANY(day_txt), ora_days, VARSIZE_ANY_EXHDR(day_txt));
CHECK_SEQ_SEARCH(d, "DAY/Day/day");
nonbizdays = (nonbizdays | (1 << d)) ^ (1 << d);
PG_RETURN_VOID();
}
示例5: similarity
Datum
similarity(PG_FUNCTION_ARGS)
{
text *in1 = PG_GETARG_TEXT_PP(0);
text *in2 = PG_GETARG_TEXT_PP(1);
TRGM *trg1,
*trg2;
float4 res;
trg1 = generate_trgm(VARDATA_ANY(in1), VARSIZE_ANY_EXHDR(in1));
trg2 = generate_trgm(VARDATA_ANY(in2), VARSIZE_ANY_EXHDR(in2));
res = cnt_sml(trg1, trg2, false);
pfree(trg1);
pfree(trg2);
PG_FREE_IF_COPY(in1, 0);
PG_FREE_IF_COPY(in2, 1);
PG_RETURN_FLOAT4(res);
}
示例6: dbms_output_next
static text *
dbms_output_next(void)
{
if (buffer_get < buffer_len)
{
text *line = cstring_to_text(buffer + buffer_get);
buffer_get += VARSIZE_ANY_EXHDR(line) + 1;
return line;
}
else
return NULL;
}
示例7: pg_logical_emit_message_bytea
/*
* SQL function for writing logical decoding message into WAL.
*/
Datum
pg_logical_emit_message_bytea(PG_FUNCTION_ARGS)
{
bool transactional = PG_GETARG_BOOL(0);
char *prefix = text_to_cstring(PG_GETARG_TEXT_PP(1));
bytea *data = PG_GETARG_BYTEA_PP(2);
XLogRecPtr lsn;
lsn = LogLogicalMessage(prefix, VARDATA_ANY(data), VARSIZE_ANY_EXHDR(data),
transactional);
PG_RETURN_LSN(lsn);
}
示例8: texticregexne
Datum
texticregexne(PG_FUNCTION_ARGS)
{
text *s = PG_GETARG_TEXT_PP(0);
text *p = PG_GETARG_TEXT_PP(1);
PG_RETURN_BOOL(!RE_compile_and_execute(p,
VARDATA_ANY(s),
VARSIZE_ANY_EXHDR(s),
regex_flavor | REG_ICASE,
0, NULL));
}
示例9: be_lowrite
Datum
be_lowrite(PG_FUNCTION_ARGS)
{
int32 fd = PG_GETARG_INT32(0);
bytea *wbuf = PG_GETARG_BYTEA_PP(1);
int bytestowrite;
int totalwritten;
bytestowrite = VARSIZE_ANY_EXHDR(wbuf);
totalwritten = lo_write(fd, VARDATA_ANY(wbuf), bytestowrite);
PG_RETURN_INT32(totalwritten);
}
示例10: rtrim1
Datum
rtrim1(PG_FUNCTION_ARGS)
{
text *string = PG_GETARG_TEXT_PP(0);
text *ret;
ret = dotrim(VARDATA_ANY(string), VARSIZE_ANY_EXHDR(string),
" ", 1,
false, true);
PG_RETURN_TEXT_P(ret);
}
示例11: hstore_defined
Datum
hstore_defined(PG_FUNCTION_ARGS)
{
HStore *hs = PG_GETARG_HS(0);
text *key = PG_GETARG_TEXT_PP(1);
HEntry *entries = ARRPTR(hs);
int idx = hstoreFindKey(hs, NULL,
VARDATA_ANY(key), VARSIZE_ANY_EXHDR(key));
bool res = (idx >= 0 && !HS_VALISNULL(entries, idx));
PG_RETURN_BOOL(res);
}
示例12: textregexne
Datum
textregexne(PG_FUNCTION_ARGS)
{
text *s = PG_GETARG_TEXT_PP(0);
text *p = PG_GETARG_TEXT_PP(1);
PG_RETURN_BOOL(!RE_compile_and_execute(p,
VARDATA_ANY(s),
VARSIZE_ANY_EXHDR(s),
REG_ADVANCED,
0, NULL));
}
示例13: dbms_random_seed_varchar
/*
* Atention!
*
* Hash function should be changed between mayor pg versions,
* don't use text based seed for regres tests!
*/
Datum
dbms_random_seed_varchar(PG_FUNCTION_ARGS)
{
text *key = PG_GETARG_TEXT_P(0);
Datum seed;
seed = hash_any((unsigned char *) VARDATA_ANY(key), VARSIZE_ANY_EXHDR(key));
srand((int) seed);
PG_RETURN_VOID();
}
示例14: levenshtein_less_equal
Datum
levenshtein_less_equal(PG_FUNCTION_ARGS)
{
text *src = PG_GETARG_TEXT_PP(0);
text *dst = PG_GETARG_TEXT_PP(1);
int max_d = PG_GETARG_INT32(2);
const char *s_data;
const char *t_data;
int s_bytes,
t_bytes;
/* Extract a pointer to the actual character data */
s_data = VARDATA_ANY(src);
t_data = VARDATA_ANY(dst);
/* Determine length of each string in bytes and characters */
s_bytes = VARSIZE_ANY_EXHDR(src);
t_bytes = VARSIZE_ANY_EXHDR(dst);
PG_RETURN_INT32(varstr_levenshtein_less_equal(s_data, s_bytes, t_data,
t_bytes, 1, 1, 1, max_d));
}
示例15: plvstr_rstrip
Datum
plvstr_rstrip (PG_FUNCTION_ARGS)
{
text *str = PG_GETARG_TEXT_PP(0);
text *pat = PG_GETARG_TEXT_PP(1);
int num = PG_GETARG_INT32(2);
int count = 0;
int len_p, len_s, i;
char *str_p, *aux_str_p, *pat_p;
len_p = VARSIZE_ANY_EXHDR(pat);
len_s = VARSIZE_ANY_EXHDR(str);
str_p = VARDATA_ANY(str) + len_s - 1;
while (count < num)
{
pat_p = VARDATA_ANY(pat) + len_p - 1;
aux_str_p = str_p;
if (len_s < len_p)
break;
for (i = 0; i < len_p; i++)
if (*aux_str_p-- != *pat_p--)
break;
if (i >= len_p)
{
count++;
/* found */
str_p = aux_str_p;
len_s -= len_p;
continue;
}
break;
}
PG_RETURN_TEXT_P(cstring_to_text_with_len(VARDATA_ANY(str),len_s));
}