|
#define | HENTRY_ISFIRST 0x80000000 |
|
#define | HENTRY_ISNULL 0x40000000 |
|
#define | HENTRY_POSMASK 0x3FFFFFFF |
|
#define | HSE_ISFIRST(he_) (((he_).entry & HENTRY_ISFIRST) != 0) |
|
#define | HSE_ISNULL(he_) (((he_).entry & HENTRY_ISNULL) != 0) |
|
#define | HSE_ENDPOS(he_) ((he_).entry & HENTRY_POSMASK) |
|
#define | HSE_OFF(he_) (HSE_ISFIRST(he_) ? 0 : HSE_ENDPOS((&(he_))[-1])) |
|
#define | HSE_LEN(he_) |
|
#define | HSTORE_MAX_KEY_LEN 0x3FFFFFFF |
|
#define | HSTORE_MAX_VALUE_LEN 0x3FFFFFFF |
|
#define | HS_FLAG_NEWVERSION 0x80000000 |
|
#define | HS_COUNT(hsp_) ((hsp_)->size_ & 0x0FFFFFFF) |
|
#define | HS_SETCOUNT(hsp_, c_) ((hsp_)->size_ = (c_) | HS_FLAG_NEWVERSION) |
|
#define | HSHRDSIZE (sizeof(HStore)) |
|
#define | CALCDATASIZE(x, lenstr) ( (x) * 2 * sizeof(HEntry) + HSHRDSIZE + (lenstr) ) |
|
#define | ARRPTR(x) ( (HEntry*) ( (HStore*)(x) + 1 ) ) |
|
#define | STRPTR(x) ( (char*)(ARRPTR(x) + HS_COUNT((HStore*)(x)) * 2) ) |
|
#define | HSTORE_KEY(arr_, str_, i_) ((str_) + HSE_OFF((arr_)[2*(i_)])) |
|
#define | HSTORE_VAL(arr_, str_, i_) ((str_) + HSE_OFF((arr_)[2*(i_)+1])) |
|
#define | HSTORE_KEYLEN(arr_, i_) (HSE_LEN((arr_)[2*(i_)])) |
|
#define | HSTORE_VALLEN(arr_, i_) (HSE_LEN((arr_)[2*(i_)+1])) |
|
#define | HSTORE_VALISNULL(arr_, i_) (HSE_ISNULL((arr_)[2*(i_)+1])) |
|
#define | HS_COPYITEM(dent_, dbuf_, dptr_, sptr_, klen_, vlen_, vnull_) |
|
#define | HS_ADDITEM(dent_, dbuf_, dptr_, pair_) |
|
#define | HS_FINALIZE(hsp_, count_, buf_, ptr_) |
|
#define | HS_FIXSIZE(hsp_, count_) |
|
#define | DatumGetHStoreP(d) hstoreUpgrade(d) |
|
#define | PG_GETARG_HSTORE_P(x) DatumGetHStoreP(PG_GETARG_DATUM(x)) |
|
#define | HStoreContainsStrategyNumber 7 |
|
#define | HStoreExistsStrategyNumber 9 |
|
#define | HStoreExistsAnyStrategyNumber 10 |
|
#define | HStoreExistsAllStrategyNumber 11 |
|
#define | HStoreOldContainsStrategyNumber 13 /* backwards compatibility */ |
|
#define | HSTORE_POLLUTE_NAMESPACE 1 |
|
#define | HSTORE_POLLUTE(newname_, oldname_) |
|
Definition at line 73 of file hstore_op.c.
100 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
101 errmsg(
"number of pairs (%d) exceeds the maximum allowed (%d)",
106 for (
i = 0,
j = 0;
i < key_count;
i++)
112 key_pairs[
j].
val = NULL;
void deconstruct_array_builtin(ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define hstoreUniquePairs
References a, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, hstoreUniquePairs, i, Pairs::isnull, j, Pairs::key, Pairs::keylen, MaxAllocSize, Pairs::needfree, palloc(), Pairs::val, Pairs::vallen, VARDATA, VARHDRSZ, and VARSIZE.
Referenced by hstore_delete_array(), hstore_exists_all(), hstore_exists_any(), and hstore_slice_to_hstore().
PGDLLEXPORT int hstoreFindKey |
( |
HStore * |
hs, |
|
|
int * |
lowbound, |
|
|
char * |
key, |
|
|
int |
keylen |
|
) |
| |
Definition at line 36 of file hstore_op.c.
39 int stopLow = lowbound ? *lowbound : 0;
44 while (stopLow < stopHigh)
48 stopMiddle = stopLow + (stopHigh - stopLow) / 2;
58 *lowbound = stopMiddle + 1;
62 stopLow = stopMiddle + 1;
64 stopHigh = stopMiddle;
Datum difference(PG_FUNCTION_ARGS)
#define HSTORE_KEY(arr_, str_, i_)
#define HSTORE_KEYLEN(arr_, i_)
References ARRPTR, difference(), HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, sort-test::key, and STRPTR.
Referenced by hstore_contains(), hstore_defined(), hstore_exists(), hstore_exists_all(), hstore_exists_any(), hstore_fetchval(), hstore_populate_record(), hstore_slice_to_array(), hstore_slice_to_hstore(), and hstore_subscript_fetch().
Definition at line 445 of file hstore_io.c.
465 for (
i = 0;
i < pcount;
i++)
#define HS_FINALIZE(hsp_, count_, buf_, ptr_)
#define HS_ADDITEM(dent_, dbuf_, dptr_, pair_)
#define HS_SETCOUNT(hsp_, c_)
#define SET_VARSIZE(PTR, len)
References ARRPTR, buf, CALCDATASIZE, HS_ADDITEM, HS_FINALIZE, HS_SETCOUNT, i, len, palloc(), SET_VARSIZE, and STRPTR.
Referenced by hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_from_text(), hstore_in(), and hstore_recv().
Definition at line 356 of file hstore_io.c.
365 *buflen =
a->keylen + ((
a->isnull) ? 0 :
a->vallen);
380 memcmp(ptr->
key,
res->key,
res->keylen) == 0)
390 *buflen +=
res->keylen + ((
res->isnull) ? 0 :
res->vallen);
399 *buflen +=
res->keylen + ((
res->isnull) ? 0 :
res->vallen);
static void PGresult * res
static int comparePairs(const void *a, const void *b)
void pfree(void *pointer)
#define qsort(a, b, c, d)
References a, comparePairs(), Pairs::key, Pairs::keylen, Pairs::needfree, pfree(), qsort, res, and Pairs::val.
Referenced by hstore_from_array(), hstore_from_arrays(), hstore_from_record(), hstore_in(), and hstore_recv().
Definition at line 236 of file hstore_compat.c.
250 if (hs->
size_ == 0 ||
261 if (!valid_old || hs->
size_ == 0)
274 elog(
ERROR,
"invalid hstore value found");
302 #ifdef HSTORE_IS_HSTORE_NEW
303 elog(
WARNING,
"ambiguous hstore value resolved as hstore-new");
312 elog(
WARNING,
"ambiguous hstore value resolved as hstore-old");
320 int count = hs->
size_;
325 for (
i = 0;
i < count; ++
i)
#define PG_DETOAST_DATUM_COPY(datum)
#define PG_DETOAST_DATUM(datum)
#define HS_FIXSIZE(hsp_, count_)
#define HS_FLAG_NEWVERSION
static int hstoreValidOldFormat(HStore *hs)
static int hstoreValidNewFormat(HStore *hs)
static Pointer DatumGetPointer(Datum X)
References ARRPTR, DatumGetPointer(), elog, HEntry::entry, ERROR, HENTRY_ISFIRST, HENTRY_ISNULL, HENTRY_POSMASK, HS_COUNT, HS_FIXSIZE, HS_FLAG_NEWVERSION, HS_SETCOUNT, HSE_ISFIRST, hstoreValidNewFormat(), hstoreValidOldFormat(), i, HOldEntry::keylen, PG_DETOAST_DATUM, PG_DETOAST_DATUM_COPY, HOldEntry::pos, HStore::size_, HOldEntry::valisnull, HOldEntry::vallen, VARSIZE, and WARNING.