mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-22 06:53:22 +02:00
unnecessary #include lines in it. Also, move some tuple routine prototypes and macros to htup.h, which allows removal of heapam.h inclusion from some .c files. For this to work, a new header file access/sysattr.h needed to be created, initially containing attribute numbers of system columns, for pg_dump usage. While at it, make contrib ltree, intarray and hstore header files more consistent with our header style.
52 lines
1.0 KiB
C
52 lines
1.0 KiB
C
/*
|
|
* $PostgreSQL: pgsql/contrib/hstore/hstore.h,v 1.6 2008/05/12 00:00:42 alvherre Exp $
|
|
*/
|
|
#ifndef __HSTORE_H__
|
|
#define __HSTORE_H__
|
|
|
|
#include "fmgr.h"
|
|
|
|
|
|
typedef struct
|
|
{
|
|
uint16 keylen;
|
|
uint16 vallen;
|
|
uint32
|
|
valisnull:1,
|
|
pos:31;
|
|
} HEntry;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
int32 vl_len_; /* varlena header (do not touch directly!) */
|
|
int4 size;
|
|
char data[1];
|
|
} HStore;
|
|
|
|
#define HSHRDSIZE (VARHDRSZ + sizeof(int4))
|
|
#define CALCDATASIZE(x, lenstr) ( (x) * sizeof(HEntry) + HSHRDSIZE + (lenstr) )
|
|
#define ARRPTR(x) ( (HEntry*) ( (char*)(x) + HSHRDSIZE ) )
|
|
#define STRPTR(x) ( (char*)(x) + HSHRDSIZE + ( sizeof(HEntry) * ((HStore*)x)->size ) )
|
|
|
|
|
|
#define PG_GETARG_HS(x) ((HStore*)PG_DETOAST_DATUM(PG_GETARG_DATUM(x)))
|
|
|
|
typedef struct
|
|
{
|
|
char *key;
|
|
char *val;
|
|
uint16 keylen;
|
|
uint16 vallen;
|
|
bool isnull;
|
|
bool needfree;
|
|
} Pairs;
|
|
|
|
int comparePairs(const void *a, const void *b);
|
|
int uniquePairs(Pairs * a, int4 l, int4 *buflen);
|
|
|
|
#define HStoreContainsStrategyNumber 7
|
|
#define HStoreExistsStrategyNumber 9
|
|
|
|
#endif /* __HSTORE_H__ */
|