2003-07-21 18:27:44 +08:00
|
|
|
#ifndef __TS_COMMON_H__
|
|
|
|
#define __TS_COMMON_H__
|
|
|
|
#include "postgres.h"
|
|
|
|
#include "fmgr.h"
|
|
|
|
|
|
|
|
#ifndef PG_NARGS
|
|
|
|
#define PG_NARGS() (fcinfo->nargs)
|
|
|
|
#endif
|
|
|
|
|
2003-08-04 08:43:34 +08:00
|
|
|
text *char2text(char *in);
|
|
|
|
text *charl2text(char *in, int len);
|
|
|
|
char *text2char(text *in);
|
|
|
|
char *pnstrdup(char *in, int len);
|
|
|
|
text *ptextdup(text *in);
|
|
|
|
text *mtextdup(text *in);
|
2003-07-21 18:27:44 +08:00
|
|
|
|
2003-08-04 08:43:34 +08:00
|
|
|
int text_cmp(text *a, text *b);
|
2003-07-21 18:27:44 +08:00
|
|
|
|
|
|
|
#define NEXTVAL(x) ( (text*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )
|
|
|
|
#define ARRNELEMS(x) ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x))
|
|
|
|
|
2003-08-04 08:43:34 +08:00
|
|
|
void ts_error(int state, const char *format,...);
|
2003-07-21 18:27:44 +08:00
|
|
|
|
2004-08-29 13:07:03 +08:00
|
|
|
extern Oid TSNSP_FunctionOid; /* oid of called function, needed only for
|
|
|
|
* determ namespace, no more */
|
|
|
|
char *get_namespace(Oid funcoid);
|
|
|
|
Oid get_oidnamespace(Oid funcoid);
|
|
|
|
|
|
|
|
#define SET_FUNCOID() do { \
|
|
|
|
if ( fcinfo->flinfo && fcinfo->flinfo->fn_oid != InvalidOid ) \
|
|
|
|
TSNSP_FunctionOid = fcinfo->flinfo->fn_oid; \
|
2004-06-01 00:51:56 +08:00
|
|
|
} while(0)
|
|
|
|
|
2003-07-21 18:27:44 +08:00
|
|
|
#endif
|