mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-04-07 18:14:13 +03:00
Compile with lnzpq
This commit is contained in:
parent
00870545b7
commit
07b51a41bf
51
nz_include/acPwcache.h
Normal file
51
nz_include/acPwcache.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#ifndef ACPWCACHE_INCLUDED
|
||||
#define ACPWCACHE_INCLUDED
|
||||
|
||||
/*
|
||||
* "C" API for manipulating the password cache
|
||||
*
|
||||
* It is not intended for appcomps code to use this interface directly. Use
|
||||
* the C++ API in acPasswordCache.h.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* lookup the cached password for host and username. Caller must free the
|
||||
* result with free() */
|
||||
bool pwcache_lookup_no_resolve(const char *host, const char *username, char **password);
|
||||
bool pwcache_lookup(const char *host, const char *username, char **password);
|
||||
|
||||
/* remove cached password entry for username and host */
|
||||
bool pwcache_delete(const char *host, const char *username);
|
||||
|
||||
/* remove all cached password entries */
|
||||
bool pwcache_clear();
|
||||
|
||||
/* save password for host and username */
|
||||
bool pwcache_save(const char *host, const char *username, const char *password);
|
||||
|
||||
/* get the current list of hosts/usernames in the cache and return number of
|
||||
* entries, or -1 on error */
|
||||
int pwcache_enum(char ***hosts, char ***usernames);
|
||||
|
||||
/* free the arrays returned by pwcache_enum */
|
||||
void pwcache_free_enum(char **hosts, char **usernames);
|
||||
|
||||
/* get the error message for the prior request */
|
||||
const char *pwcache_errmsg();
|
||||
|
||||
bool pwcache_resetkey(bool none);
|
||||
|
||||
/* Control verbose output */
|
||||
void pwcache_set_verbose(bool verbose);
|
||||
|
||||
/* Control Resolving hostnames */
|
||||
void pwcache_set_resolve_mode(bool resolve);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
35
nz_include/bitarch.h
Executable file
35
nz_include/bitarch.h
Executable file
|
@ -0,0 +1,35 @@
|
|||
#ifndef _BITARCH_H_
|
||||
#define _BITARCH_H_
|
||||
/* -*-C-*-
|
||||
* (C) Copyright IBM Corp. 2001, 2012 All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set this to 1 to have 64 bit SPU
|
||||
*/
|
||||
#ifndef SPU_64BIT
|
||||
#define SPU_64BIT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set this to 1 for 64 bit HOST.
|
||||
* It's turned off yet but once the host is 64 bit we can turn it on again
|
||||
*/
|
||||
#ifndef HOST_64BIT
|
||||
#define HOST_64BIT 1
|
||||
#endif
|
||||
|
||||
/* explicitly defined VARHDRSZ */
|
||||
|
||||
/*
|
||||
* Check if following items are in sync:
|
||||
* class NzVarlena in nde/misc/geninl.h
|
||||
* class NzVarlena in nde/expr/pgwrap.h
|
||||
* struct varlena in pg/include/c.h
|
||||
* struct varattrib in pg/include/postgres.h
|
||||
*/
|
||||
|
||||
#define VARLENA_HDR_64BIT 1
|
||||
#define VARHDRSZ ((uint32)16)
|
||||
|
||||
#endif /* _BITARCH_H_ */
|
876
nz_include/c.h
Normal file
876
nz_include/c.h
Normal file
|
@ -0,0 +1,876 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* c.h
|
||||
* Fundamental C definitions. This is included by every .c file in
|
||||
* PostgreSQL (via either postgres.h or postgres_fe.h, as appropriate).
|
||||
*
|
||||
* Note that the definitions here are not intended to be exposed to
|
||||
* clients of the frontend interface libraries --- so we don't worry
|
||||
* much about polluting the namespace with lots of stuff...
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
*----------------------------------------------------------------
|
||||
* TABLE OF CONTENTS
|
||||
*
|
||||
* When adding stuff to this file, please try to put stuff
|
||||
* into the relevant section, or add new sections as appropriate.
|
||||
*
|
||||
* section description
|
||||
* ------- ------------------------------------------------
|
||||
* 0) config.h and standard system headers
|
||||
* 1) hacks to cope with non-ANSI C compilers
|
||||
* 2) bool, true, false, TRUE, FALSE, NULL
|
||||
* 3) standard system types
|
||||
* 4) IsValid macros for system types
|
||||
* 5) offsetof, lengthof, endof, alignment
|
||||
* 6) widely useful macros
|
||||
* 7) random stuff
|
||||
* 8) system-specific hacks
|
||||
* 9) assertions
|
||||
|
||||
*
|
||||
* NOTE: since this file is included by both frontend and backend modules,
|
||||
* it's almost certainly wrong to put an "extern" declaration here.
|
||||
* typedefs and macros are the kind of thing that might go here.
|
||||
*
|
||||
*----------------------------------------------------------------
|
||||
*/
|
||||
#ifndef C_H
|
||||
#define C_H
|
||||
|
||||
#include "postgres_ext.h"
|
||||
|
||||
/* For C++, we want all the ISO C standard macros as well. */
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
# define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
#ifndef __STDC_CONSTANT_MACROS
|
||||
# define __STDC_CONSTANT_MACROS
|
||||
#endif
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
# define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
||||
#include "postgres_ext.h"
|
||||
|
||||
/* We have to include stdlib.h here because it defines many of these macros
|
||||
on some platforms, and we only want our definitions used if stdlib.h doesn't
|
||||
have its own. The same goes for stddef and stdarg if present.
|
||||
*/
|
||||
|
||||
#include "pg_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#ifdef STRING_H_WITH_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/fcntl.h> /* ensure O_BINARY is available */
|
||||
#endif
|
||||
#ifdef HAVE_SUPPORTDEFS_H
|
||||
# include <SupportDefs.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
# include "bitarch.h"
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 1: hacks to cope with non-ANSI C compilers
|
||||
*
|
||||
* type prefixes (const, signed, volatile, inline) are now handled in config.h.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* CppAsString
|
||||
* Convert the argument to a string, usingclause the C preprocessor.
|
||||
* CppConcat
|
||||
* Concatenate two arguments together, usingclause the C preprocessor.
|
||||
*
|
||||
* Note: the standard Autoconf macro AC_C_STRINGIZE actually only checks
|
||||
* whether #identifier works, but if we have that we likely have ## too.
|
||||
*/
|
||||
#if defined(HAVE_STRINGIZE)
|
||||
|
||||
# define CppAsString(identifier) # identifier
|
||||
# define CppConcat(x, y) x##y
|
||||
|
||||
#else /* !HAVE_STRINGIZE */
|
||||
|
||||
# define CppAsString(identifier) "identifier"
|
||||
|
||||
/*
|
||||
* CppIdentity -- On Reiser based cpp's this is used to concatenate
|
||||
* two tokens. That is
|
||||
* CppIdentity(A)B ==> AB
|
||||
* We renamed it to _private_CppIdentity because it should not
|
||||
* be referenced outside this file. On other cpp's it
|
||||
* produces A B.
|
||||
*/
|
||||
# define _priv_CppIdentity(x) x
|
||||
# define CppConcat(x, y) _priv_CppIdentity(x) y
|
||||
|
||||
#endif /* !HAVE_STRINGIZE */
|
||||
|
||||
/*
|
||||
* dummyret is used to set return values in macros that use ?: to make
|
||||
* assignments. gcc wants these to be void, other compilers like char
|
||||
*/
|
||||
#ifdef __GNUC__ /* GNU cc */
|
||||
# define dummyret void
|
||||
#else
|
||||
# define dummyret char
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only
|
||||
* used in assert-enabled builds, to avoid compiler warnings about unused
|
||||
* variables in assert-disabled builds.
|
||||
*/
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
# define PG_USED_FOR_ASSERTS_ONLY
|
||||
#else
|
||||
# define PG_USED_FOR_ASSERTS_ONLY pg_attribute_unused()
|
||||
#endif
|
||||
|
||||
#define PG_PRINTF_ATTRIBUTE printf
|
||||
/* GCC and XLC support format attributes */
|
||||
#if defined(__GNUC__) || defined(__IBMC__)
|
||||
# define pg_attribute_format_arg(a) __attribute__((format_arg(a)))
|
||||
# define pg_attribute_printf(f, a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a)))
|
||||
#else
|
||||
# define pg_attribute_format_arg(a)
|
||||
# define pg_attribute_printf(f, a)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hints to the compiler about the likelihood of a branch. Both likely() and
|
||||
* unlikely() return the boolean value of the contained expression.
|
||||
*
|
||||
* These should only be used sparingly, in very hot code paths. It's very easy
|
||||
* to mis-estimate likelihoods.
|
||||
*/
|
||||
#if __GNUC__ >= 3
|
||||
# define likely(x) __builtin_expect((x) != 0, 1)
|
||||
# define unlikely(x) __builtin_expect((x) != 0, 0)
|
||||
#else
|
||||
# define likely(x) ((x) != 0)
|
||||
# define unlikely(x) ((x) != 0)
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 2: bool, true, false, TRUE, FALSE, NULL
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* bool
|
||||
* Boolean value, either true or false.
|
||||
*
|
||||
*/
|
||||
|
||||
/* BeOS defines bool already, but the compiler chokes on the
|
||||
* #ifndef unless we wrap it in this check.
|
||||
*/
|
||||
#ifndef __BEOS__
|
||||
|
||||
# ifndef __cplusplus
|
||||
# ifndef bool_defined
|
||||
# define bool_defined
|
||||
typedef char bool;
|
||||
# endif /* ndef bool */
|
||||
|
||||
# ifndef true
|
||||
# define true 1
|
||||
# endif
|
||||
|
||||
# ifndef false
|
||||
# define false 0
|
||||
# endif
|
||||
# endif /* not C++ */
|
||||
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
typedef bool *BoolPtr;
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NULL
|
||||
* Null pointer.
|
||||
*/
|
||||
#ifndef NULL
|
||||
# define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 3: standard system types
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pointer
|
||||
* Variable holding address of any memory resident object.
|
||||
*
|
||||
* XXX Pointer arithmetic is done with this, so it can't be void *
|
||||
* under "true" ANSI compilers.
|
||||
*/
|
||||
typedef char *Pointer;
|
||||
|
||||
/*
|
||||
* intN
|
||||
* Signed integer, EXACTLY N BITS IN SIZE,
|
||||
* used for numerical computations and the
|
||||
* frontend/backend protocol.
|
||||
*/
|
||||
#ifndef __BEOS__ /* this shouldn't be required, but is is! */
|
||||
# if !AIX
|
||||
typedef signed char int8; /* == 8 bits */
|
||||
typedef signed short int16; /* == 16 bits */
|
||||
typedef signed int int32; /* == 32 bits */
|
||||
# endif
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
/*
|
||||
* uintN
|
||||
* Unsigned integer, EXACTLY N BITS IN SIZE,
|
||||
* used for numerical computations and the
|
||||
* frontend/backend protocol.
|
||||
*/
|
||||
#ifndef __BEOS__ /* this shouldn't be required, but is is! */
|
||||
typedef unsigned char uint8; /* == 8 bits */
|
||||
typedef unsigned short uint16; /* == 16 bits */
|
||||
typedef unsigned int uint32; /* == 32 bits */
|
||||
#endif /* __BEOS__ */
|
||||
|
||||
/*
|
||||
* boolN
|
||||
* Boolean value, AT LEAST N BITS IN SIZE.
|
||||
*/
|
||||
typedef uint8 bool8; /* >= 8 bits */
|
||||
typedef uint16 bool16; /* >= 16 bits */
|
||||
typedef uint32 bool32; /* >= 32 bits */
|
||||
|
||||
/*
|
||||
* bitsN
|
||||
* Unit of bitwise operation, AT LEAST N BITS IN SIZE.
|
||||
*/
|
||||
typedef uint8 bits8; /* >= 8 bits */
|
||||
typedef uint16 bits16; /* >= 16 bits */
|
||||
typedef uint32 bits32; /* >= 32 bits */
|
||||
|
||||
/*
|
||||
* wordN
|
||||
* Unit of storage, AT LEAST N BITS IN SIZE,
|
||||
* used to fetch/store data.
|
||||
*/
|
||||
typedef uint8 word8; /* >= 8 bits */
|
||||
typedef uint16 word16; /* >= 16 bits */
|
||||
typedef uint32 word32; /* >= 32 bits */
|
||||
|
||||
/*
|
||||
* floatN
|
||||
* Floating point number, AT LEAST N BITS IN SIZE,
|
||||
* used for numerical computations.
|
||||
*
|
||||
* Since sizeof(floatN) may be > sizeof(char *), always pass
|
||||
* floatN by reference.
|
||||
*
|
||||
* XXX: these typedefs are now deprecated in favor of float4 and float8.
|
||||
* They will eventually go away.
|
||||
*/
|
||||
typedef float float32data;
|
||||
typedef double float64data;
|
||||
typedef float *float32;
|
||||
typedef double *float64;
|
||||
|
||||
/*
|
||||
* 64-bit integers -- use standard types for these
|
||||
*/
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
#define INT64CONST(x) INT64_C(x)
|
||||
#define UINT64CONST(x) UINT64_C(x)
|
||||
|
||||
/*
|
||||
* Size
|
||||
* Size of any memory resident object, as returned by sizeof.
|
||||
*/
|
||||
typedef size_t Size;
|
||||
|
||||
/*
|
||||
* Index
|
||||
* Index into any memory resident array.
|
||||
*
|
||||
* Note:
|
||||
* Indices are non negative.
|
||||
*/
|
||||
typedef unsigned int Index;
|
||||
|
||||
/*
|
||||
* Offset
|
||||
* Offset into any memory resident array.
|
||||
*
|
||||
* Note:
|
||||
* This differs from an Index in that an Index is always
|
||||
* non negative, whereas Offset may be negative.
|
||||
*/
|
||||
typedef signed int Offset;
|
||||
|
||||
/*
|
||||
* Common Postgres datatype names (as used in the catalogs)
|
||||
*/
|
||||
typedef char int1;
|
||||
typedef int16 int2;
|
||||
typedef int32 int4;
|
||||
typedef float float4;
|
||||
typedef double float8;
|
||||
|
||||
typedef int8 timestamp;
|
||||
typedef int4 date;
|
||||
typedef int4 abstime;
|
||||
|
||||
/*
|
||||
* Oid, RegProcedure, TransactionId, CommandId
|
||||
*/
|
||||
|
||||
/* typedef Oid is in postgres_ext.h */
|
||||
|
||||
/* unfortunately, both regproc and RegProcedure are used */
|
||||
typedef Oid regproc;
|
||||
typedef Oid RegProcedure;
|
||||
|
||||
typedef uint32 TransactionId;
|
||||
|
||||
#define InvalidTransactionId 0
|
||||
|
||||
typedef uint32 CommandId;
|
||||
|
||||
#define FirstCommandId 0
|
||||
|
||||
/*
|
||||
* Array indexing support
|
||||
*/
|
||||
#define MAXDIM 6
|
||||
typedef struct
|
||||
{
|
||||
int indx[MAXDIM];
|
||||
} IntArrayMAXDIM; // NZ: blast name conflict
|
||||
|
||||
/* ----------------
|
||||
* Variable-length datatypes all share the 'struct varlena' header.
|
||||
*
|
||||
* NOTE: for TOASTable types, this is an oversimplification, since the value
|
||||
* may be compressed or moved out-of-line. However datatype-specific
|
||||
* routines are mostly content to deal with de-TOASTed values only, and of
|
||||
* course client-side routines should never see a TOASTed value. See
|
||||
* postgres.h for details of the TOASTed form.
|
||||
* ----------------
|
||||
*/
|
||||
// The following items must be in sync:
|
||||
// class NzVarlena in nde/misc/geninl.h
|
||||
// class NzVarlena in nde/expr/pgwrap.h
|
||||
// struct varlena in pg/include/c.h
|
||||
// struct varattrib in pg/include/postgres.h
|
||||
// struct varattrib in udx-source/udx-impls/v2/UDX_Varargs.cpp
|
||||
struct varlena
|
||||
{
|
||||
int32 vl_len;
|
||||
int32 vl_fixedlen;
|
||||
union
|
||||
{
|
||||
char *vl_ptr;
|
||||
int64 vl_align; // allow for 64bit pointers
|
||||
};
|
||||
char vl_dat[1];
|
||||
};
|
||||
|
||||
/*
|
||||
* These widely-used datatypes are just a varlena header and the data bytes.
|
||||
* There is no terminating null or anything like that --- the data length is
|
||||
* always VARSIZE(ptr) - VARHDRSZ.
|
||||
*/
|
||||
typedef struct varlena bytea;
|
||||
typedef struct varlena text;
|
||||
typedef struct varlena BpChar; /* blank-padded char, ie SQL char(n) */
|
||||
typedef struct varlena VarChar; /* var-length char, ie SQL varchar(n) */
|
||||
typedef struct varlena VarBin; /* var-length binary, ie SQL varbin(n) */
|
||||
typedef struct varlena *JsonPtr;
|
||||
typedef struct _Jsonb *JsonbPtr;
|
||||
typedef struct _JsonPath *JsonPathPtr;
|
||||
/*
|
||||
* Fixed-length array types (these are not varlena's!)
|
||||
*/
|
||||
|
||||
typedef int2 int2vector[INDEX_MAX_KEYS];
|
||||
typedef Oid oidvector[INDEX_MAX_KEYS];
|
||||
|
||||
/*
|
||||
* We want NameData to have length NAMEDATALEN and int alignment,
|
||||
* because that's how the data type 'name' is defined in pg_type.
|
||||
* Use a union to make sure the compiler agrees.
|
||||
*/
|
||||
typedef union nameData
|
||||
{
|
||||
char data[NAMEDATALEN];
|
||||
int alignmentDummy;
|
||||
} NameData;
|
||||
typedef NameData *Name;
|
||||
|
||||
#define NameStr(name) ((name).data)
|
||||
|
||||
/*
|
||||
* stdint.h limits aren't guaranteed to be present and aren't guaranteed to
|
||||
* have compatible types with our fixed width types. So just define our own.
|
||||
*/
|
||||
#define PG_INT8_MIN (-0x7F - 1)
|
||||
#define PG_INT8_MAX (0x7F)
|
||||
#define PG_UINT8_MAX (0xFF)
|
||||
#define PG_INT16_MIN (-0x7FFF - 1)
|
||||
#define PG_INT16_MAX (0x7FFF)
|
||||
#define PG_UINT16_MAX (0xFFFF)
|
||||
#define PG_INT32_MIN (-0x7FFFFFFF - 1)
|
||||
#define PG_INT32_MAX (0x7FFFFFFF)
|
||||
#define PG_UINT32_MAX (0xFFFFFFFFU)
|
||||
#define PG_INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)
|
||||
#define PG_INT64_MAX INT64CONST(0x7FFFFFFFFFFFFFFF)
|
||||
#define PG_UINT64_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF)
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 4: IsValid macros for system types
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* BoolIsValid
|
||||
* True iff bool is valid.
|
||||
*/
|
||||
#define BoolIsValid(boolean) ((boolean) == false || (boolean) == true)
|
||||
|
||||
/*
|
||||
* PointerIsValid
|
||||
* True iff pointer is valid.
|
||||
*/
|
||||
#define PointerIsValid(pointer) ((void *) (pointer) != NULL)
|
||||
|
||||
/*
|
||||
* PointerIsAligned
|
||||
* True iff pointer is properly aligned to point to the given type.
|
||||
*/
|
||||
#define PointerIsAligned(pointer, type) (((intptr_t) (pointer) % (sizeof(type))) == 0)
|
||||
|
||||
#define OidIsValid(objectId) ((bool) ((objectId) != InvalidOid))
|
||||
|
||||
#define RegProcedureIsValid(p) OidIsValid(p)
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 5: offsetof, lengthof, endof, alignment
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* offsetof
|
||||
* Offset of a structure/union field within that structure/union.
|
||||
*
|
||||
* XXX This is supposed to be part of stddef.h, but isn't on
|
||||
* some systems (like SunOS 4).
|
||||
*/
|
||||
#ifndef offsetof
|
||||
# define offsetof(type, field) ((long) &((type *) 0)->field)
|
||||
#endif /* offsetof */
|
||||
|
||||
/*
|
||||
* lengthof
|
||||
* Number of elements in an array.
|
||||
*/
|
||||
#ifndef lengthof
|
||||
# define lengthof(array) (sizeof(array) / sizeof((array)[0]))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* endof
|
||||
* Address of the element one past the last in an array.
|
||||
*/
|
||||
#ifndef endof
|
||||
# define endof(array) (&array[lengthof(array)])
|
||||
#endif
|
||||
|
||||
/* ----------------
|
||||
* Alignment macros: align a length or address appropriately for a given type.
|
||||
*
|
||||
* There used to be some incredibly crufty platform-dependent hackery here,
|
||||
* but now we rely on the configure script to get the info for us. Much nicer.
|
||||
*
|
||||
* NOTE: TYPEALIGN will not work if ALIGNVAL is not a power of 2.
|
||||
* That case seems extremely unlikely to occur in practice, however.
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
#define TYPEALIGN(ALIGNVAL, LEN) \
|
||||
(((intptr_t) (LEN) + (ALIGNVAL - 1)) & ~((intptr_t) (ALIGNVAL - 1)))
|
||||
|
||||
#define SHORTALIGN(LEN) TYPEALIGN(ALIGNOF_SHORT, (LEN))
|
||||
#define INTALIGN(LEN) TYPEALIGN(ALIGNOF_INT, (LEN))
|
||||
#define LONGALIGN(LEN) TYPEALIGN(ALIGNOF_LONG, (LEN))
|
||||
#define DOUBLEALIGN(LEN) TYPEALIGN(ALIGNOF_DOUBLE, (LEN))
|
||||
#define MAXALIGN(LEN) TYPEALIGN(MAXIMUM_ALIGNOF, (LEN))
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 6: widely useful macros
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* Max
|
||||
* Return the maximum of two numbers.
|
||||
*/
|
||||
#define Max(x, y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
/*
|
||||
* Min
|
||||
* Return the minimum of two numbers.
|
||||
*/
|
||||
#define Min(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
/*
|
||||
* Abs
|
||||
* Return the absolute value of the argument.
|
||||
*/
|
||||
#define Abs(x) ((x) >= 0 ? (x) : -(x))
|
||||
|
||||
/* Get a bit mask of the bits set in non-int32 aligned addresses */
|
||||
#define INT_ALIGN_MASK (sizeof(int32) - 1)
|
||||
|
||||
/* Get a bit mask of the bits set in non-long aligned addresses */
|
||||
#define LONG_ALIGN_MASK (sizeof(long) - 1)
|
||||
|
||||
/*
|
||||
* MemSet
|
||||
* Exactly the same as standard library function memset(), but considerably
|
||||
* faster for zeroing small word-aligned structures (such as parsetree nodes).
|
||||
* This has to be a macro because the main point is to avoid function-call
|
||||
* overhead.
|
||||
*
|
||||
* We got the 64 number by testing this against the stock memset() on
|
||||
* BSD/OS 3.0. Larger values were slower. bjm 1997/09/11
|
||||
*
|
||||
* I think the crossover point could be a good deal higher for
|
||||
* most platforms, actually. tgl 2000-03-19
|
||||
*/
|
||||
#ifdef MemSet
|
||||
# undef MemSet
|
||||
#endif
|
||||
#define MemSet(start, val, len) \
|
||||
do { \
|
||||
char *_start = (char *) (start); \
|
||||
int _val = (val); \
|
||||
Size _len = (len); \
|
||||
\
|
||||
if ((((long) _start) & INT_ALIGN_MASK) == 0 && (_len & INT_ALIGN_MASK) == 0 && _val == 0 && \
|
||||
_len <= MEMSET_LOOP_LIMIT) { \
|
||||
int32 *_p = (int32 *) _start; \
|
||||
int32 *_stop = (int32 *) (_start + _len); \
|
||||
while (_p < _stop) \
|
||||
*_p++ = 0; \
|
||||
} else \
|
||||
memset(_start, _val, _len); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* MemSetAligned is the same as MemSet except it omits the test to see if
|
||||
* "start" is word-aligned. This is okay to use if the caller knows a-priori
|
||||
* that the pointer is suitably aligned (typically, because he just got it
|
||||
* from palloc(), which always delivers a max-aligned pointer).
|
||||
*/
|
||||
#define MemSetAligned(start, val, len) \
|
||||
do { \
|
||||
long *_start = (long *) (start); \
|
||||
int _val = (val); \
|
||||
Size _len = (len); \
|
||||
\
|
||||
if ((_len & LONG_ALIGN_MASK) == 0 && _val == 0 && _len <= MEMSET_LOOP_LIMIT && \
|
||||
MEMSET_LOOP_LIMIT != 0) { \
|
||||
long *_stop = (long *) ((char *) _start + _len); \
|
||||
while (_start < _stop) \
|
||||
*_start++ = 0; \
|
||||
} else \
|
||||
memset(_start, _val, _len); \
|
||||
} while (0)
|
||||
|
||||
#define MEMSET_LOOP_LIMIT 64
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 7: random stuff
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* msb for char */
|
||||
#define CSIGNBIT (0x80)
|
||||
#define IS_HIGHBIT_SET(ch) ((unsigned char) (ch) &CSIGNBIT)
|
||||
|
||||
#define STATUS_OK (0)
|
||||
#define STATUS_ERROR (-1)
|
||||
#define STATUS_NOT_FOUND (-2)
|
||||
#define STATUS_INVALID (-3)
|
||||
#define STATUS_UNCATALOGUED (-4)
|
||||
#define STATUS_REPLACED (-5)
|
||||
#define STATUS_NOT_DONE (-6)
|
||||
#define STATUS_BAD_PACKET (-7)
|
||||
#define STATUS_TIMEOUT (-8)
|
||||
#define STATUS_FOUND (1)
|
||||
|
||||
/*
|
||||
* Macro that allows to cast constness and volatile away from an expression, but doesn't
|
||||
* allow changing the underlying type. Enforcement of the latter
|
||||
* currently only works for gcc like compilers.
|
||||
*
|
||||
* Please note IT IS NOT SAFE to cast constness away if the result will ever
|
||||
* be modified (it would be undefined behaviour). Doing so anyway can cause
|
||||
* compiler misoptimizations or runtime crashes (modifying readonly memory).
|
||||
* It is only safe to use when the result will not be modified, but API
|
||||
* design or language restrictions prevent you from declaring that
|
||||
* (e.g. because a function returns both const and non-const variables).
|
||||
*
|
||||
* Note that this only works in function scope, not for global variables (it'd
|
||||
* be nice, but not trivial, to improve that).
|
||||
*/
|
||||
#if defined(HAVE__BUILTIN_TYPES_COMPATIBLE_P)
|
||||
# define unconstify(underlying_type, expr) \
|
||||
(StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), const underlying_type), \
|
||||
"wrong cast"), \
|
||||
(underlying_type) (expr))
|
||||
# define unvolatize(underlying_type, expr) \
|
||||
(StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), volatile underlying_type), \
|
||||
"wrong cast"), \
|
||||
(underlying_type) (expr))
|
||||
#else
|
||||
# define unconstify(underlying_type, expr) ((underlying_type) (expr))
|
||||
# define unvolatize(underlying_type, expr) ((underlying_type) (expr))
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 8: system-specific hacks
|
||||
*
|
||||
* This should be limited to things that absolutely have to be
|
||||
* included in every source file. The port-specific header file
|
||||
* is usually a better place for this sort of thing.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# define PG_BINARY O_BINARY
|
||||
# define PG_BINARY_R "rb"
|
||||
# define PG_BINARY_W "wb"
|
||||
#else
|
||||
# define PG_BINARY 0
|
||||
# define PG_BINARY_R "r"
|
||||
# define PG_BINARY_W "w"
|
||||
#endif
|
||||
|
||||
#if defined(linux)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(sun) && defined(__sparc__) && !defined(__SVR4)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* These are for things that are one way on Unix and another on NT */
|
||||
#define NULL_DEV "/dev/null"
|
||||
#define SEP_CHAR '/'
|
||||
|
||||
/* defines for dynamic linking on Win32 platform */
|
||||
#ifdef __CYGWIN__
|
||||
# if __GNUC__ && !defined(__declspec)
|
||||
# error You need egcs 1.1 or newer for compiling!
|
||||
# endif
|
||||
# ifdef BUILDING_DLL
|
||||
# define DLLIMPORT __declspec(dllexport)
|
||||
# else /* not BUILDING_DLL */
|
||||
# define DLLIMPORT __declspec(dllimport)
|
||||
# endif
|
||||
#else /* not CYGWIN */
|
||||
# define DLLIMPORT
|
||||
#endif
|
||||
|
||||
/* Provide prototypes for routines not present in a particular machine's
|
||||
* standard C library. It'd be better to put these in config.h, but
|
||||
* in config.h we haven't yet included anything that defines size_t...
|
||||
*/
|
||||
|
||||
#ifndef HAVE_SNPRINTF_DECL
|
||||
extern int snprintf(char *str, size_t count, const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VSNPRINTF_DECL
|
||||
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_MEMMOVE) && !defined(memmove)
|
||||
# define memmove(d, s, c) bcopy(s, d, c)
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* Section 9: exception handling definitions
|
||||
* Assert, Trap, etc macros
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef char *ExcMessage;
|
||||
|
||||
typedef struct Exception
|
||||
{
|
||||
ExcMessage message;
|
||||
} Exception;
|
||||
|
||||
extern Exception FailedAssertion;
|
||||
extern Exception BadArg;
|
||||
extern Exception BadState;
|
||||
extern Exception VarTagError;
|
||||
|
||||
extern bool assert_enabled;
|
||||
extern bool log_mask_all_strings;
|
||||
|
||||
extern int ExceptionalCondition(const char *conditionName,
|
||||
Exception *exceptionP,
|
||||
const char *details,
|
||||
const char *fileName,
|
||||
int lineNumber);
|
||||
|
||||
/*
|
||||
* USE_ASSERT_CHECKING, if defined, turns on all the assertions.
|
||||
* - plai 9/5/90
|
||||
*
|
||||
* It should _NOT_ be defined in releases or in benchmark copies
|
||||
*/
|
||||
|
||||
/*
|
||||
* Trap
|
||||
* Generates an exception if the given condition is true.
|
||||
*
|
||||
*/
|
||||
#define Trap(condition, exception) \
|
||||
do { \
|
||||
if ((assert_enabled) && (condition)) \
|
||||
ExceptionalCondition(CppAsString(condition), &(exception), NULL, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* TrapMacro is the same as Trap but it's intended for use in macros:
|
||||
*
|
||||
* #define foo(x) (AssertM(x != 0) && bar(x))
|
||||
*
|
||||
* Isn't CPP fun?
|
||||
*/
|
||||
#define TrapMacro(condition, exception) \
|
||||
((bool) ((!assert_enabled) || !(condition) || \
|
||||
(ExceptionalCondition(CppAsString(condition), &(exception), NULL, __FILE__, __LINE__))))
|
||||
|
||||
#ifndef USE_ASSERT_CHECKING
|
||||
# define Assert(condition)
|
||||
# define AssertMacro(condition) ((void) true)
|
||||
# define AssertArg(condition)
|
||||
# define AssertState(condition)
|
||||
# define assert_enabled 0
|
||||
|
||||
#elif defined(FRONTEND)
|
||||
|
||||
# include <assert.h>
|
||||
# define Assert(p) assert(p)
|
||||
# define AssertMacro(p) ((void) assert(p))
|
||||
# define AssertArg(condition) assert(condition)
|
||||
# define AssertState(condition) assert(condition)
|
||||
# define AssertPointerAlignment(ptr, bndr) ((void) true)
|
||||
|
||||
#else
|
||||
# define Assert(condition) Trap(!(condition), FailedAssertion)
|
||||
|
||||
# define AssertMacro(condition) ((void) TrapMacro(!(condition), FailedAssertion))
|
||||
|
||||
# define AssertArg(condition) Trap(!(condition), BadArg)
|
||||
|
||||
# define AssertState(condition) Trap(!(condition), BadState)
|
||||
|
||||
#endif /* USE_ASSERT_CHECKING */
|
||||
|
||||
/*
|
||||
* LogTrap
|
||||
* Generates an exception with a message if the given condition is true.
|
||||
*
|
||||
*/
|
||||
#define LogTrap(condition, exception, printArgs) \
|
||||
do { \
|
||||
if ((assert_enabled) && (condition)) \
|
||||
ExceptionalCondition(CppAsString(condition), \
|
||||
&(exception), \
|
||||
vararg_format printArgs, \
|
||||
__FILE__, \
|
||||
__LINE__); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* LogTrapMacro is the same as LogTrap but it's intended for use in macros:
|
||||
*
|
||||
* #define foo(x) (LogAssertMacro(x != 0, "yow!") && bar(x))
|
||||
*/
|
||||
#define LogTrapMacro(condition, exception, printArgs) \
|
||||
((bool) ((!assert_enabled) || !(condition) || \
|
||||
(ExceptionalCondition(CppAsString(condition), \
|
||||
&(exception), \
|
||||
vararg_format printArgs, \
|
||||
__FILE__, \
|
||||
__LINE__))))
|
||||
|
||||
extern char *vararg_format(const char *fmt, ...);
|
||||
|
||||
#ifndef USE_ASSERT_CHECKING
|
||||
# define LogAssert(condition, printArgs)
|
||||
# define LogAssertMacro(condition, printArgs) true
|
||||
# define LogAssertArg(condition, printArgs)
|
||||
# define LogAssertState(condition, printArgs)
|
||||
#else
|
||||
# define LogAssert(condition, printArgs) LogTrap(!(condition), FailedAssertion, printArgs)
|
||||
|
||||
# define LogAssertMacro(condition, printArgs) LogTrapMacro(!(condition), FailedAssertion, printArgs)
|
||||
|
||||
# define LogAssertArg(condition, printArgs) LogTrap(!(condition), BadArg, printArgs)
|
||||
|
||||
# define LogAssertState(condition, printArgs) LogTrap(!(condition), BadState, printArgs)
|
||||
|
||||
# ifdef ASSERT_CHECKING_TEST
|
||||
extern int assertTest(int val);
|
||||
|
||||
# endif
|
||||
|
||||
#endif /* USE_ASSERT_CHECKING */
|
||||
|
||||
#ifdef __cplusplus /* NZ */
|
||||
# define CEXTERN extern "C"
|
||||
#else
|
||||
# define CEXTERN extern
|
||||
#endif
|
||||
|
||||
/* ----------------
|
||||
* end of c.h
|
||||
* ----------------
|
||||
*/
|
||||
#endif /* C_H */
|
85
nz_include/comtypes.h
Normal file
85
nz_include/comtypes.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
// comtypes.h
|
||||
//
|
||||
// definitions of fundamental types shared across pg and nz
|
||||
//
|
||||
// This header file is included in many other include files system-wide, so
|
||||
// any additions to it must be applicable to a very wide variety of
|
||||
// situations.
|
||||
//
|
||||
// NOTE TO DEVELOPERS:
|
||||
//
|
||||
// Please be careful about what you add to this file. Changes to this file
|
||||
// impact almost every other source file in the system.
|
||||
//
|
||||
// (C) Copyright IBM Corp. 2002, 2011 All Rights Reserved.
|
||||
|
||||
#ifndef COMTYPES_H_
|
||||
#define COMTYPES_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
/*
|
||||
* :host64: When Oid was declared as unsigned int here we are allocation
|
||||
* always an array of 12 chars.
|
||||
* The value numeric_limits<unsigned int>::max() is: 4294967295. We might have
|
||||
* negative values, so:
|
||||
* - 1 for the sign,
|
||||
* - 10 for the number
|
||||
* - 1 from '\0'
|
||||
* TOTAL: 12.
|
||||
*
|
||||
* Now that we have unsigned long int we need to change this value.
|
||||
* - numeric_limits<unsigned long>::max() is: 18446744073709551615 ==> 20 (no sign)
|
||||
* - numeric_limits<long>::max() is: 9223372036854775807 ==> 19.(with sign)
|
||||
* - we need one for the sign (if signed)
|
||||
* - we need one for '\0'
|
||||
* TOTAL: 21.
|
||||
*/
|
||||
|
||||
// :host64:
|
||||
typedef unsigned int INTERNALOID;
|
||||
typedef INTERNALOID Oid;
|
||||
|
||||
// :host64: we moved it from postgres_ext.h to have Oid and OID_MAX in one place
|
||||
#define OID_MAX UINT_MAX
|
||||
|
||||
#define OIDMAXLENGTH 12 /* ((1)+(10)+(1)) */
|
||||
|
||||
// :host64: we want to add a standard way to print-scan basic types in Postgres
|
||||
// in a sort of standard way. We use the same approach used by inttypes.h.
|
||||
|
||||
#define __PRI0id_PREFIX /* For 64-bit: "l" */
|
||||
|
||||
#define PRI0id __PRI0id_PREFIX "u"
|
||||
// "PRI0id"
|
||||
|
||||
#define __PRIx_PREFIXZERO "8" /* For 64bit: "16" */
|
||||
|
||||
#define PRIx0id "0" __PRIx_PREFIXZERO __PRI0id_PREFIX "x"
|
||||
#define PRIX0id "0" __PRIx_PREFIXZERO __PRI0id_PREFIX "X"
|
||||
// "PRIx0id"
|
||||
|
||||
typedef uintptr_t Datum;
|
||||
|
||||
/*
|
||||
* We need a #define symbol for sizeof(Datum) for use in some #if tests.
|
||||
*/
|
||||
#ifdef __x86_64__
|
||||
# define SIZEOF_DATUM 8
|
||||
#else
|
||||
# define SIZEOF_DATUM 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* To stay backward compatible with older kits.
|
||||
* This is used for storing consts in Datum by value
|
||||
* for types other than INT8, at least currently.
|
||||
*
|
||||
*/
|
||||
enum
|
||||
{
|
||||
LegacyCompatibleDatumSize = 4
|
||||
};
|
||||
|
||||
#define SIZEOF_VOID_P SIZEOF_DATUM
|
||||
#endif /* COMTYPES_H_ */
|
508
nz_include/libpq-fe.h
Normal file
508
nz_include/libpq-fe.h
Normal file
|
@ -0,0 +1,508 @@
|
|||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* libpq-fe.h
|
||||
* This file contains definitions for structures and
|
||||
* externs for functions used by frontend postgres applications.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef LIBPQ_FE_H
|
||||
#define LIBPQ_FE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
/* postgres_ext.h defines the backend's externally visible types,
|
||||
* such as Oid.
|
||||
*/
|
||||
#include "postgres_ext.h"
|
||||
#include "c.h"
|
||||
#include "acPwcache.h"
|
||||
|
||||
/* Application-visible enum types */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
/*
|
||||
* Although you may decide to change this list in some way, values
|
||||
* which become unused should never be removed, nor should
|
||||
* constants be redefined - that would break compatibility with
|
||||
* existing code.
|
||||
*/
|
||||
CONNECTION_OK,
|
||||
CONNECTION_BAD,
|
||||
CONNECTION_TERM, /* connection terminated by host */
|
||||
/* Non-blocking mode only below here */
|
||||
|
||||
/*
|
||||
* The existence of these should never be relied upon - they
|
||||
* should only be used for user feedback or similar purposes.
|
||||
*/
|
||||
CONNECTION_STARTED, /* Waiting for connection to be made. */
|
||||
CONNECTION_MADE, /* Connection OK; waiting to send. */
|
||||
CONNECTION_STARTUP, /* Connection OK; use startup packet */
|
||||
CONNECTION_HANDSHAKE, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_CLIENT_REQUEST, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_CLIENT_RESPONSE, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_SERVER_REQUEST, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_SERVER_RESPONSE, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the
|
||||
* postmaster. */
|
||||
CONNECTION_SSL_REQUEST, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_SSL_RESPONSE, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_SSL_CONNECTING, /* Connection OK; use handshake protocol */
|
||||
CONNECTION_AUTH_OK, /* Received authentication; waiting for
|
||||
* backend startup. */
|
||||
CONNECTION_SETENV /* Negotiating environment. */
|
||||
} ConnStatusType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PGRES_POLLING_FAILED = 0,
|
||||
PGRES_POLLING_READING, /* These two indicate that one may */
|
||||
PGRES_POLLING_WRITING, /* use select before polling again. */
|
||||
PGRES_POLLING_OK,
|
||||
PGRES_POLLING_ACTIVE /* Can call poll function immediately. */
|
||||
} PostgresPollingStatusType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PGRES_EMPTY_QUERY = 0,
|
||||
PGRES_COMMAND_OK, /* a query command that doesn't return
|
||||
* anything was executed properly by the
|
||||
* backend */
|
||||
PGRES_TUPLES_OK, /* a query command that returns tuples was
|
||||
* executed properly by the backend,
|
||||
* PGresult contains the result tuples */
|
||||
PGRES_COPY_OUT, /* Copy Out data transfer in progress */
|
||||
PGRES_COPY_IN, /* Copy In data transfer in progress */
|
||||
PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from
|
||||
* the backend */
|
||||
PGRES_NONFATAL_ERROR,
|
||||
PGRES_FATAL_ERROR,
|
||||
PGRES_FATAL_ERROR_TERM
|
||||
} ExecStatusType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PQSHOW_CONTEXT_NEVER, /* never show CONTEXT field */
|
||||
PQSHOW_CONTEXT_ERRORS, /* show CONTEXT for errors only (default) */
|
||||
PQSHOW_CONTEXT_ALWAYS /* always show CONTEXT field */
|
||||
} PGContextVisibility;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PQERRORS_TERSE, /* single-line error messages */
|
||||
PQERRORS_DEFAULT, /* recommended style */
|
||||
PQERRORS_VERBOSE, /* all the facts, ma'am */
|
||||
PQERRORS_SQLSTATE /* only error severity and SQLSTATE code */
|
||||
} PGVerbosity;
|
||||
|
||||
/* PGconn encapsulates a connection to the backend.
|
||||
* The contents of this struct are not supposed to be known to applications.
|
||||
*/
|
||||
typedef struct pg_conn PGconn;
|
||||
|
||||
/* PGresult encapsulates the result of a query (or more precisely, of a single
|
||||
* SQL command --- a query string given to PQsendQuery can contain multiple
|
||||
* commands and thus return multiple PGresult objects).
|
||||
* The contents of this struct are not supposed to be known to applications.
|
||||
*/
|
||||
typedef struct pg_result PGresult;
|
||||
|
||||
/* PGnotify represents the occurrence of a NOTIFY message.
|
||||
* Ideally this would be an opaque typedef, but it's so simple that it's
|
||||
* unlikely to change.
|
||||
* NOTE: in Postgres 6.4 and later, the be_pid is the notifying backend's,
|
||||
* whereas in earlier versions it was always your own backend's PID.
|
||||
*/
|
||||
typedef struct pgNotify
|
||||
{
|
||||
char relname[NAMEDATALEN]; /* name of relation
|
||||
* containing data */
|
||||
int be_pid; /* process id of backend */
|
||||
} PGnotify;
|
||||
|
||||
/* PQnoticeProcessor is the function type for the notice-message callback.
|
||||
*/
|
||||
typedef void (*PQnoticeProcessor) (void *arg, const char *message);
|
||||
|
||||
/* Print options for PQprint() */
|
||||
typedef char pqbool;
|
||||
|
||||
typedef struct _PQprintOpt
|
||||
{
|
||||
pqbool header; /* print output field headings and row
|
||||
* count */
|
||||
pqbool align; /* fill align the fields */
|
||||
pqbool standard; /* old brain dead format */
|
||||
pqbool html3; /* output html tables */
|
||||
pqbool expanded; /* expand tables */
|
||||
pqbool pager; /* use pager for output if needed */
|
||||
char *fieldSep; /* field separator */
|
||||
char *tableOpt; /* insert to HTML <table ...> */
|
||||
char *caption; /* HTML <caption> */
|
||||
char **fieldName; /* null terminated array of repalcement
|
||||
* field names */
|
||||
} PQprintOpt;
|
||||
|
||||
/* ----------------
|
||||
* Structure for the conninfo parameter definitions returned by PQconndefaults
|
||||
*
|
||||
* All fields except "val" point at static strings which must not be altered.
|
||||
* "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
|
||||
* will release both the val strings and the PQconninfoOption array itself.
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct _PQconninfoOption
|
||||
{
|
||||
const char *keyword; /* The keyword of the option */
|
||||
const char *envvar; /* Fallback environment variable name */
|
||||
const char *compiled; /* Fallback compiled in default value */
|
||||
char *val; /* Option's current value, or NULL */
|
||||
const char *label; /* Label for field in connect dialog */
|
||||
const char *dispchar; /* Character to display for this field in
|
||||
* a connect dialog. Values are: ""
|
||||
* Display entered value as is "*"
|
||||
* Password field - hide value "D" Debug
|
||||
* option - don't show by default */
|
||||
int dispsize; /* Field size in characters for dialog */
|
||||
} PQconninfoOption;
|
||||
|
||||
/* ----------------
|
||||
* PQArgBlock -- structure for PQfn() arguments
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int len;
|
||||
int isint;
|
||||
union
|
||||
{
|
||||
int *ptr; /* can't use void (dec compiler barfs) */
|
||||
int integer;
|
||||
} u;
|
||||
} PQArgBlock;
|
||||
|
||||
/* ----------------
|
||||
* AddOpt -- Additional options passed by nzsql
|
||||
* ----------------
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int securityLevel;
|
||||
char *caCertFile;
|
||||
} AddOpt;
|
||||
|
||||
/* ----------------
|
||||
* Exported functions of libpq
|
||||
* ----------------
|
||||
*/
|
||||
|
||||
/* === in fe-connect.c === */
|
||||
|
||||
/* make a new client connection to the backend */
|
||||
|
||||
/* Asynchronous (non-blocking) */
|
||||
extern PGconn *PQconnectStart(const char *conninfo);
|
||||
extern void PQfreeconnection(PGconn *conn);
|
||||
extern PostgresPollingStatusType PQconnectPoll(PGconn *conn);
|
||||
/* Synchronous (blocking) */
|
||||
extern PGconn *PQconnectdb(const char *conninfo);
|
||||
extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport,
|
||||
const char *pgoptions, const char *pgtty,
|
||||
const char *dbName, const char *login,
|
||||
const char *pwd, const AddOpt* add_opt,
|
||||
const bool quiet, const bool admin_mode,
|
||||
const bool noPassword);
|
||||
#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) \
|
||||
PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
|
||||
|
||||
extern PGconn *PQsetdbLoginTermOld(const char *pghost, const char *pgport,
|
||||
const char *pgoptions, const char *pgtty,
|
||||
const char *dbName,
|
||||
const char *login, const char *pwd, const int prevPid,
|
||||
const int secLevel, const char *caCertfile,
|
||||
const char *priorUser, const char *priorPwd,
|
||||
const bool quiet);
|
||||
|
||||
/* close the current connection and free the PGconn data structure */
|
||||
extern void PQfinish(PGconn *conn);
|
||||
|
||||
/* get info about connection options known to PQconnectdb */
|
||||
extern PQconninfoOption *PQconndefaults(void);
|
||||
|
||||
/* free the data structure returned by PQconndefaults() */
|
||||
extern void PQconninfoFree(PQconninfoOption *connOptions);
|
||||
|
||||
/*
|
||||
* close the current connection and restablish a new one with the same
|
||||
* parameters
|
||||
*/
|
||||
/* Asynchronous (non-blocking) */
|
||||
extern int PQresetStart(PGconn *conn);
|
||||
extern PostgresPollingStatusType PQresetPoll(PGconn *conn);
|
||||
/* Synchronous (blocking) */
|
||||
extern void PQreset(PGconn *conn);
|
||||
|
||||
/* issue a cancel request */
|
||||
extern int PQrequestCancel(PGconn *conn);
|
||||
|
||||
/* Accessor functions for PGconn objects */
|
||||
extern char *PQdb(const PGconn *conn);
|
||||
extern char *PQuser(const PGconn *conn);
|
||||
extern void PQsetdbname(PGconn *conn, const char* dbname);
|
||||
extern void PQsetusername(PGconn *conn, const char* username);
|
||||
extern char *PQpass(const PGconn *conn);
|
||||
extern char *PQhost(const PGconn *conn);
|
||||
extern char *PQport(const PGconn *conn);
|
||||
extern char *PQtty(const PGconn *conn);
|
||||
extern char *PQoptions(const PGconn *conn);
|
||||
extern ConnStatusType PQstatus(const PGconn *conn);
|
||||
extern const char *PQerrorMessage(const PGconn *conn);
|
||||
extern void PQresetErrorMessage(PGconn *conn);
|
||||
extern int PQsocket(const PGconn *conn);
|
||||
extern int PQbackendPID(const PGconn *conn);
|
||||
extern int PQsetNzEncoding(PGconn *conn, const int nz_encoding);
|
||||
extern int PQsetLoadReplayRegion(PGconn *conn, const int64 regionSize);
|
||||
extern int PQclientEncoding(const PGconn *conn);
|
||||
extern int PQsetClientEncoding(PGconn *conn, const char *encoding);
|
||||
/* Get the SSL structure associated with a connection */
|
||||
extern SSL *PQgetssl(PGconn *conn);
|
||||
/* To check for a NULL return */
|
||||
const char* SSLcheckError();
|
||||
|
||||
/* Enable/disable tracing */
|
||||
extern void PQtrace(PGconn *conn, FILE *debug_port);
|
||||
extern void PQuntrace(PGconn *conn);
|
||||
|
||||
/* Override default notice processor */
|
||||
extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg);
|
||||
|
||||
/* === in fe-exec.c === */
|
||||
|
||||
/* Simple synchronous query */
|
||||
extern PGresult *PQexec(PGconn *conn, const char *query);
|
||||
extern PGresult *PQbatchexec(PGconn *conn, const char *query,
|
||||
int batch_rowset);
|
||||
extern PGnotify *PQnotifies(PGconn *conn);
|
||||
|
||||
/* Interface for multiple-result or asynchronous queries */
|
||||
extern int PQsendQuery(PGconn *conn, const char *query);
|
||||
extern PGresult *PQgetResult(PGconn *conn);
|
||||
|
||||
/* Routines for managing an asychronous query */
|
||||
extern int PQisBusy(PGconn *conn);
|
||||
extern int PQconsumeInput(PGconn *conn);
|
||||
|
||||
/* Routines for copy in/out */
|
||||
extern int PQgetline(PGconn *conn, char *string, int length);
|
||||
extern int PQputline(PGconn *conn, const char *string);
|
||||
extern int PQgetlineAsync(PGconn *conn, char *buffer, int bufsize);
|
||||
extern int PQputnbytes(PGconn *conn, const char *buffer, int nbytes);
|
||||
extern int PQendcopy(PGconn *conn);
|
||||
|
||||
/* Set blocking/nonblocking connection to the backend */
|
||||
extern int PQsetnonblocking(PGconn *conn, int arg);
|
||||
extern int PQisnonblocking(const PGconn *conn);
|
||||
|
||||
/* Force the write buffer to be written (or at least try) */
|
||||
extern int PQflush(PGconn *conn);
|
||||
|
||||
/* Batching */
|
||||
extern void PQresetbatchdex(PGconn *conn);
|
||||
extern int PQgetbatchdex(PGconn *conn);
|
||||
extern void PQincrementbatchdex(PGconn *conn);
|
||||
extern bool PQcommand_complete(PGconn *conn);
|
||||
|
||||
/*
|
||||
* "Fast path" interface --- not really recommended for application
|
||||
* use
|
||||
*/
|
||||
extern PGresult *PQfn(PGconn *conn,
|
||||
int fnid,
|
||||
int *result_buf,
|
||||
int *result_len,
|
||||
int result_is_int,
|
||||
const PQArgBlock *args,
|
||||
int nargs);
|
||||
extern PGresult *PQset_plan_output_file(PGconn *conn,
|
||||
char *plan_output_file,
|
||||
bool is_dir);
|
||||
|
||||
/* Accessor functions for PGresult objects */
|
||||
extern ExecStatusType PQresultStatus(const PGresult *res);
|
||||
extern const char *PQresStatus(ExecStatusType status);
|
||||
extern const char *PQresultErrorMessage(const PGresult *res);
|
||||
extern int PQntuples(const PGresult *res);
|
||||
extern void PQsetntuples(PGresult *res, int ntups);
|
||||
extern int PQnfields(const PGresult *res);
|
||||
extern int PQbinaryTuples(const PGresult *res);
|
||||
extern char *PQfname(const PGresult *res, int field_num);
|
||||
extern int PQfnumber(const PGresult *res, const char *field_name);
|
||||
extern Oid PQftype(const PGresult *res, int field_num);
|
||||
extern int PQfsize(const PGresult *res, int field_num);
|
||||
extern int PQfmod(const PGresult *res, int field_num);
|
||||
extern char *PQcmdStatus(PGresult *res);
|
||||
extern const char *PQoidStatus(const PGresult *res); /* old and ugly */
|
||||
extern Oid PQoidValue(const PGresult *res); /* new and improved */
|
||||
extern const char *PQcmdTuples(PGresult *res);
|
||||
extern char *PQgetvalue(const PGresult *res, int tup_num, int field_num);
|
||||
extern int PQgetlength(const PGresult *res, int tup_num, int field_num);
|
||||
extern int PQgetisnull(const PGresult *res, int tup_num, int field_num);
|
||||
extern void PQresult_inc_total_ntups(PGresult *res);
|
||||
extern uint64 PQresult_get_total_ntups(const PGresult *res);
|
||||
extern void PQresult_reset_ntups(PGresult *res);
|
||||
extern bool PQresult_is_batching(const PGresult *res);
|
||||
extern void PQresetcommandcomplete(PGconn *conn);
|
||||
extern void PQresetCancelPending(PGconn *conn);
|
||||
|
||||
/* Delete a PGresult */
|
||||
extern void PQclear(PGresult *res);
|
||||
|
||||
/*
|
||||
* Make an empty PGresult with given status (some apps find this
|
||||
* useful). If conn is not NULL and status indicates an error, the
|
||||
* conn's errorMessage is copied.
|
||||
*/
|
||||
extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status);
|
||||
|
||||
/* NETEZZA - add three functions to resolve undefines when linked with php-pgsql-4.3.9-3.6 (LAS4) */
|
||||
|
||||
/* Quoting strings before inclusion in queries. */
|
||||
extern size_t PQescapeString(char *to, const char *from, size_t length);
|
||||
extern char *PQescapeIdentifier(PGconn *conn, const char *str, size_t len, bool as_ident);
|
||||
extern unsigned char *PQescapeBytea(const unsigned char *bintext, size_t binlen,
|
||||
size_t *bytealen);
|
||||
extern unsigned char *PQunescapeBytea(const unsigned char *strtext,
|
||||
size_t *retbuflen);
|
||||
|
||||
/*
|
||||
* Dbos tuple mode
|
||||
*/
|
||||
extern void SetDbosTupleHandler(int (*cbfun) (PGconn *conn));
|
||||
|
||||
/*
|
||||
* Functions for get/se commandNumber
|
||||
*/
|
||||
extern void PQsetCommandNumber(PGconn *conn, int cn);
|
||||
extern int PQgetCommandNumber(PGconn *conn);
|
||||
|
||||
|
||||
/* === in fe-print.c === */
|
||||
|
||||
extern void PQprint(FILE *fout, /* output stream */
|
||||
const PGresult *res,
|
||||
const PQprintOpt *ps); /* option structure */
|
||||
|
||||
/*
|
||||
* really old printing routines
|
||||
*/
|
||||
extern void PQdisplayTuples(const PGresult *res,
|
||||
FILE *fp, /* where to send the
|
||||
* output */
|
||||
int fillAlign, /* pad the fields with
|
||||
* spaces */
|
||||
const char *fieldSep, /* field separator */
|
||||
int printHeader, /* display headers? */
|
||||
int quiet);
|
||||
|
||||
extern void PQprintTuples(const PGresult *res,
|
||||
FILE *fout, /* output stream */
|
||||
int printAttName, /* print attribute names */
|
||||
int terseOutput, /* delimiter bars */
|
||||
int width); /* width of column, if
|
||||
* 0, use variable width */
|
||||
|
||||
|
||||
/* === in fe-lobj.c === */
|
||||
|
||||
/* Large-object access routines */
|
||||
extern int lo_open(PGconn *conn, Oid lobjId, int mode);
|
||||
extern int lo_close(PGconn *conn, int fd);
|
||||
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
|
||||
extern int lo_write(PGconn *conn, int fd, char *buf, size_t len);
|
||||
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
|
||||
extern Oid lo_creat(PGconn *conn, int mode);
|
||||
extern int lo_tell(PGconn *conn, int fd);
|
||||
extern int lo_unlink(PGconn *conn, Oid lobjId);
|
||||
extern Oid lo_import(PGconn *conn, const char *filename);
|
||||
extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
|
||||
|
||||
/* === in fe-misc.c === */
|
||||
|
||||
/* Determine length of multibyte encoded char at *s */
|
||||
extern int PQmblen(const unsigned char *s, int encoding);
|
||||
|
||||
/* Determine display length of multibyte encoded char at *s */
|
||||
extern int PQdsplen(const unsigned char *s, int encoding);
|
||||
|
||||
/* Get encoding id from environment variable PGCLIENTENCODING */
|
||||
extern int PQenv2encoding(void);
|
||||
|
||||
/* === for arrow adbc: start === */
|
||||
/*
|
||||
* Note: The following functions will have incremental changes as and when required
|
||||
* in supporting ADBC drivers.
|
||||
*/
|
||||
extern PGresult *PQprepare(PGconn *conn, const char *stmtName,
|
||||
const char *query, int nParams,
|
||||
const Oid *paramTypes);
|
||||
|
||||
extern PGresult *PQexecParams(PGconn *conn,
|
||||
const char *command,
|
||||
int nParams,
|
||||
const Oid *paramTypes,
|
||||
const char *const *paramValues,
|
||||
const int *paramLengths,
|
||||
const int *paramFormats,
|
||||
int resultFormat);
|
||||
|
||||
extern PGresult *PQexecPrepared(PGconn *conn,
|
||||
const char *stmtName,
|
||||
int nParams,
|
||||
const Oid *paramTypes,
|
||||
const char *const *paramValues,
|
||||
const int *paramLengths,
|
||||
const int *paramFormats,
|
||||
int resultFormat);
|
||||
|
||||
extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt);
|
||||
|
||||
extern int PQsendQueryPrepared(PGconn *conn,
|
||||
const char *stmtName,
|
||||
int nParams,
|
||||
const Oid *paramTypes,
|
||||
const char *const *paramValues,
|
||||
const int *paramLengths,
|
||||
const int *paramFormats,
|
||||
int resultFormat);
|
||||
|
||||
extern int PQsendQueryParams(PGconn *conn,
|
||||
const char *command,
|
||||
int nParams,
|
||||
const Oid *paramTypes,
|
||||
const char *const *paramValues,
|
||||
const int *paramLengths,
|
||||
const int *paramFormats,
|
||||
int resultFormat);
|
||||
|
||||
/* === for arrow adbc: end === */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* LIBPQ_FE_H */
|
632
nz_include/nzfieldtype.h
Normal file
632
nz_include/nzfieldtype.h
Normal file
|
@ -0,0 +1,632 @@
|
|||
#ifndef NZFIELDTYPE_H
|
||||
#define NZFIELDTYPE_H
|
||||
|
||||
// Field type numbers are persisted in the compressed external
|
||||
// table header. Extending this list with new types is fine.
|
||||
// The existing constants up to NzTypeLastEntry cannot be renumbered
|
||||
// (check with Abhishek Jog for details about external table usage).
|
||||
// If you change an existing type number, we need to write some backward
|
||||
// compatibility code.
|
||||
|
||||
#define NZ_FIELD_TYPE_LIST \
|
||||
\
|
||||
/* (ORDINAL, ENUMERATOR, REP, ALIGN, FIXED, SCHEMA, ZMACCUM, COMPARE, DESCRIPTION) \
|
||||
*/ \
|
||||
\
|
||||
_ROW_(0, NzTypeUndefined, void, 0, 0, INVALID, invalid, Bad, "UNUSED 0") \
|
||||
_SEP_ _ROW_(1, \
|
||||
NzTypeRecAddr, \
|
||||
int64, \
|
||||
ALN64, \
|
||||
8, \
|
||||
INT, \
|
||||
invalid, \
|
||||
Int8, \
|
||||
"RecAddr (8 bytes)") _SEP_ _ROW_(2, \
|
||||
NzTypeDouble, \
|
||||
double, \
|
||||
ALN64, \
|
||||
8, \
|
||||
FLOAT, \
|
||||
double, \
|
||||
Double, \
|
||||
"FP double (8 bytes)") _SEP_ \
|
||||
_ROW_(3, NzTypeInt, int32, ALN32, 4, INT, int32, Int4, "Integer (4 bytes)") _SEP_ _ROW_( \
|
||||
4, \
|
||||
NzTypeFloat, \
|
||||
float, \
|
||||
ALN32, \
|
||||
4, \
|
||||
FLOAT, \
|
||||
float, \
|
||||
Float, \
|
||||
"FP single (4 bytes)") _SEP_ _ROW_(5, \
|
||||
NzTypeMoney, \
|
||||
int32, \
|
||||
ALN32, \
|
||||
4, \
|
||||
INT, \
|
||||
int32, \
|
||||
Int4, \
|
||||
"Money (4 bytes)") _SEP_ \
|
||||
_ROW_(6, NzTypeDate, int32, ALN32, 4, INT, int32, Int4, "Date (4 bytes)") _SEP_ _ROW_( \
|
||||
7, \
|
||||
NzTypeNumeric, \
|
||||
void, \
|
||||
ALN128, \
|
||||
-1, \
|
||||
NUMERIC, \
|
||||
cnum64, \
|
||||
Bad, \
|
||||
"Numeric (4, 8 or 16 bytes)") _SEP_ _ROW_(8, \
|
||||
NzTypeTime, \
|
||||
int64, \
|
||||
ALN64, \
|
||||
8, \
|
||||
INT, \
|
||||
int64, \
|
||||
Int8, \
|
||||
"Time (8 bytes)") \
|
||||
_SEP_ _ROW_(9, \
|
||||
NzTypeTimestamp, \
|
||||
timestamp, \
|
||||
ALN64, \
|
||||
8, \
|
||||
INT, \
|
||||
int64, \
|
||||
Int8, \
|
||||
"Timestamp (8 bytes)") _SEP_ _ROW_(10, \
|
||||
NzTypeInterval, \
|
||||
interval, \
|
||||
ALN128, \
|
||||
12, \
|
||||
TIME, \
|
||||
interval, \
|
||||
Interval, \
|
||||
"Interval (12 bytes)") \
|
||||
_SEP_ _ROW_(11, \
|
||||
NzTypeTimeTz, \
|
||||
timetz, \
|
||||
ALN128, \
|
||||
12, \
|
||||
TIME, \
|
||||
timetz, \
|
||||
TimeTz, \
|
||||
"Time and TZ (12 bytes)") _SEP_ _ROW_(12, \
|
||||
NzTypeBool, \
|
||||
int8, \
|
||||
ALNNO, \
|
||||
1, \
|
||||
INT, \
|
||||
int8, \
|
||||
Bool, \
|
||||
"Boolean (1 byte)") \
|
||||
_SEP_ _ROW_( \
|
||||
13, \
|
||||
NzTypeInt1, \
|
||||
int8, \
|
||||
ALNNO, \
|
||||
1, \
|
||||
INT, \
|
||||
int8, \
|
||||
Int1, \
|
||||
"Integer (1 byte)") _SEP_ _ROW_(14, \
|
||||
NzTypeBinary, \
|
||||
void, \
|
||||
0, \
|
||||
0, \
|
||||
INVALID, \
|
||||
invalid, \
|
||||
Bad, \
|
||||
"UNUSED 14") _SEP_ _ROW_(15, \
|
||||
NzTypeChar, \
|
||||
void, \
|
||||
ALNNO, \
|
||||
-2, \
|
||||
FIXEDCHAR, \
|
||||
str1A, \
|
||||
Bad, \
|
||||
"Char (fixed, " \
|
||||
"1-16 bytes)") \
|
||||
_SEP_ _ROW_(16, \
|
||||
NzTypeVarChar, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"ASCII Char Varying") _SEP_ _ROW_(17, \
|
||||
NzDEPR_Text, \
|
||||
void, \
|
||||
FVARY, \
|
||||
0, \
|
||||
INVALID, \
|
||||
invalid, \
|
||||
Bad, \
|
||||
"UNUSED 17") \
|
||||
_SEP_ _ROW_( \
|
||||
18, \
|
||||
NzTypeUnknown, \
|
||||
void, \
|
||||
FVARY, \
|
||||
0, \
|
||||
INVALID, \
|
||||
invalid, \
|
||||
Bad, \
|
||||
"UNUSED 18") _SEP_ _ROW_(19, \
|
||||
NzTypeInt2, \
|
||||
int16, \
|
||||
ALN16, \
|
||||
2, \
|
||||
INT, \
|
||||
int16, \
|
||||
Int2, \
|
||||
"Integer (2 " \
|
||||
"bytes)") _SEP_ _ROW_(20, \
|
||||
NzTypeInt8, \
|
||||
int64, \
|
||||
ALN64, \
|
||||
8, \
|
||||
INT, \
|
||||
int64, \
|
||||
Int8, \
|
||||
"Integer (8 " \
|
||||
"bytes)") \
|
||||
_SEP_ _ROW_(21, \
|
||||
NzTypeVarFixedChar, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"ASCII Char (using " \
|
||||
"varying)") _SEP_ _ROW_(22, \
|
||||
NzTypeGeometry, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"ST_Geometry") \
|
||||
_SEP_ _ROW_(23, \
|
||||
NzTypeVarBinary, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"Binary Varying") _SEP_ _ROW_(24, \
|
||||
NzDEPR_Blob, \
|
||||
void, \
|
||||
FVARY, \
|
||||
0, \
|
||||
INVALID, \
|
||||
invalid, \
|
||||
Bad, \
|
||||
"UNUSED 24") \
|
||||
_SEP_ _ROW_( \
|
||||
25, \
|
||||
NzTypeNChar, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"UTF-8 NChar " \
|
||||
"(using varying)") _SEP_ _ROW_(26, \
|
||||
NzTypeNVarChar, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"UTF-8 NChar Varying") \
|
||||
_SEP_ _ROW_( \
|
||||
27, \
|
||||
NzDEPR_NText, \
|
||||
void, \
|
||||
FVARY, \
|
||||
0, \
|
||||
INVALID, \
|
||||
invalid, \
|
||||
Bad, \
|
||||
"UNUSED 27") _SEP_ _ROW_(28, \
|
||||
NzTypeDTIDBitAddr, \
|
||||
int64, \
|
||||
ALN64, \
|
||||
8, \
|
||||
INT, \
|
||||
invalid, \
|
||||
Int8, \
|
||||
"DTIDBitAddr (8 bytes)") \
|
||||
_SEP_ _ROW_(29, \
|
||||
NzTypeSuperDouble, \
|
||||
cnum128, \
|
||||
ALN128, \
|
||||
16, \
|
||||
FLOAT, \
|
||||
invalid, \
|
||||
SuperDouble, \
|
||||
"FP super double (16 bytes)") \
|
||||
_SEP_ _ROW_(30, \
|
||||
NzTypeJson, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"JSON") _SEP_ _ROW_(31, \
|
||||
NzTypeJsonb, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"JSONB") \
|
||||
_SEP_ _ROW_(32, \
|
||||
NzTypeJsonpath, \
|
||||
varA, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varA, \
|
||||
Bad, \
|
||||
"JSONPATH") \
|
||||
_SEP_ _ROW_( \
|
||||
33, \
|
||||
NzTypeLastEntry, \
|
||||
void, \
|
||||
0, \
|
||||
0, \
|
||||
INVALID, \
|
||||
invalid, \
|
||||
Bad, \
|
||||
"UNUSED 33") /* Entries past \
|
||||
NzTypeLastEntry \
|
||||
are used only \
|
||||
in zonemap \
|
||||
code, via \
|
||||
fieldTypeWithSize(), \
|
||||
and are not \
|
||||
persistent. \
|
||||
*/ \
|
||||
_SEP_ _ROW_( \
|
||||
34, \
|
||||
NzTypeChar1A, \
|
||||
str1A, \
|
||||
ALNNO, \
|
||||
1, \
|
||||
FIXEDCHAR, \
|
||||
str1A, \
|
||||
Bad, \
|
||||
"ASCII Char[1] (1 byte)") _SEP_ _ROW_(35, \
|
||||
NzTypeChar2A, \
|
||||
str2A, \
|
||||
ALNNO, \
|
||||
2, \
|
||||
FIXEDCHAR, \
|
||||
str2A, \
|
||||
Bad, \
|
||||
"ASCII Char[2] (2 bytes)") _SEP_ _ROW_(36, \
|
||||
NzTypeChar3A, \
|
||||
str3A, \
|
||||
ALNNO, \
|
||||
3, \
|
||||
FIXEDCHAR, \
|
||||
str3A, \
|
||||
Bad, \
|
||||
"ASCII " \
|
||||
"Char[3] " \
|
||||
"(3 bytes)") _SEP_ \
|
||||
_ROW_(37, NzTypeChar4A, str4A, ALNNO, 4, FIXEDCHAR, str4A, Bad, "ASCII Char[4] (4 bytes)") _SEP_ _ROW_( \
|
||||
38, \
|
||||
NzTypeChar5A, \
|
||||
str5A, \
|
||||
ALNNO, \
|
||||
5, \
|
||||
FIXEDCHAR, \
|
||||
str5A, \
|
||||
Bad, \
|
||||
"ASCII Char[5] (5 bytes)") _SEP_ _ROW_(39, \
|
||||
NzTypeChar6A, \
|
||||
str6A, \
|
||||
ALNNO, \
|
||||
6, \
|
||||
FIXEDCHAR, \
|
||||
str6A, \
|
||||
Bad, \
|
||||
"ASCII Char[6] (6 bytes)") _SEP_ _ROW_(40, \
|
||||
NzTypeChar7A, \
|
||||
str7A, \
|
||||
ALNNO, \
|
||||
7, \
|
||||
FIXEDCHAR, \
|
||||
str7A, \
|
||||
Bad, \
|
||||
"ASCII" \
|
||||
" Char" \
|
||||
"[7] " \
|
||||
"(7 " \
|
||||
"bytes" \
|
||||
")") _SEP_ \
|
||||
_ROW_(41, NzTypeChar8A, str8A, ALNNO, 8, FIXEDCHAR, str8, Bad, "ASCII Char[8] (8 bytes)") _SEP_ _ROW_( \
|
||||
42, \
|
||||
NzTypeChar9A, \
|
||||
str9A, \
|
||||
ALNNO, \
|
||||
9, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"ASCII Char[9] (9 bytes)") _SEP_ \
|
||||
_ROW_(43, NzTypeChar10A, str10A, ALNNO, 10, FIXEDCHAR, str8, Bad, "ASCII Char[10] (10 bytes)") _SEP_ _ROW_( \
|
||||
44, \
|
||||
NzTypeChar11A, \
|
||||
str11A, \
|
||||
ALNNO, \
|
||||
11, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"ASCII Char[11] (11 bytes)") _SEP_ _ROW_(45, \
|
||||
NzTypeChar12A, \
|
||||
str12A, \
|
||||
ALNNO, \
|
||||
12, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"ASCII Char[12] (12 bytes)") _SEP_ \
|
||||
_ROW_(46, NzTypeChar13A, str13A, ALNNO, 13, FIXEDCHAR, str8, Bad, "ASCII Char[13] (13 bytes)") _SEP_ _ROW_( \
|
||||
47, \
|
||||
NzTypeChar14A, \
|
||||
str14A, \
|
||||
ALNNO, \
|
||||
14, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"ASCII Char[14] (14 bytes)") _SEP_ \
|
||||
_ROW_(48, NzTypeChar15A, str15A, ALNNO, 15, FIXEDCHAR, str8, Bad, "ASCII Char[15] (15 bytes)") _SEP_ _ROW_( \
|
||||
49, \
|
||||
NzTypeChar16A, \
|
||||
str16A, \
|
||||
ALNNO, \
|
||||
16, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"ASCII Char[16] (16 bytes)") _SEP_ \
|
||||
_ROW_(50, \
|
||||
NzTypeChar1E, \
|
||||
str1E, \
|
||||
ALNNO, \
|
||||
1, \
|
||||
FIXEDCHAR, \
|
||||
str1E, \
|
||||
Bad, \
|
||||
"EBCDIC Char[1] (1 byte)") _SEP_ _ROW_(51, \
|
||||
NzTypeChar2E, \
|
||||
str2E, \
|
||||
ALNNO, \
|
||||
2, \
|
||||
FIXEDCHAR, \
|
||||
str2E, \
|
||||
Bad, \
|
||||
"EBCDIC Char[2] (2 " \
|
||||
"bytes)") _SEP_ _ROW_(52, \
|
||||
NzTypeChar3E, \
|
||||
str3E, \
|
||||
ALNNO, \
|
||||
3, \
|
||||
FIXEDCHAR, \
|
||||
str3E, \
|
||||
Bad, \
|
||||
"EBCDIC Char[3] (3 bytes)") _SEP_ \
|
||||
_ROW_(53, NzTypeChar4E, str4E, ALNNO, 4, FIXEDCHAR, str4E, Bad, "EBCDIC Char[4] (4 bytes)") _SEP_ _ROW_( \
|
||||
54, \
|
||||
NzTypeChar5E, \
|
||||
str5E, \
|
||||
ALNNO, \
|
||||
5, \
|
||||
FIXEDCHAR, \
|
||||
str5E, \
|
||||
Bad, \
|
||||
"EBCDIC Char[5] (5 bytes)") _SEP_ \
|
||||
_ROW_(55, NzTypeChar6E, str6E, ALNNO, 6, FIXEDCHAR, str6E, Bad, "EBCDIC Char[6] (6 bytes)") _SEP_ _ROW_( \
|
||||
56, \
|
||||
NzTypeChar7E, \
|
||||
str7E, \
|
||||
ALNNO, \
|
||||
7, \
|
||||
FIXEDCHAR, \
|
||||
str7E, \
|
||||
Bad, \
|
||||
"EBCDIC Char[7] (7 bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
57, \
|
||||
NzTypeChar8E, \
|
||||
str8E, \
|
||||
ALNNO, \
|
||||
8, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC Char[8] (8 bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
58, \
|
||||
NzTypeChar9E, \
|
||||
str9E, \
|
||||
ALNNO, \
|
||||
9, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC Char[9] (9 bytes)") _SEP_ \
|
||||
_ROW_(59, NzTypeChar10E, str10E, ALNNO, 10, FIXEDCHAR, str8, Bad, "EBCDIC Char[10] (10 bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
60, \
|
||||
NzTypeChar11E, \
|
||||
str11E, \
|
||||
ALNNO, \
|
||||
11, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC Char[11] (11 bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
61, \
|
||||
NzTypeChar12E, \
|
||||
str12E, \
|
||||
ALNNO, \
|
||||
12, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC Char[12] (12 " \
|
||||
"bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
62, \
|
||||
NzTypeChar13E, \
|
||||
str13E, \
|
||||
ALNNO, \
|
||||
13, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC Char[13] (13 " \
|
||||
"bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
63, \
|
||||
NzTypeChar14E, \
|
||||
str14E, \
|
||||
ALNNO, \
|
||||
14, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC Char[14] " \
|
||||
"(14 bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
64, \
|
||||
NzTypeChar15E, \
|
||||
str15E, \
|
||||
ALNNO, \
|
||||
15, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC " \
|
||||
"Char[15] (15 " \
|
||||
"bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
65, \
|
||||
NzTypeChar16E, \
|
||||
str16E, \
|
||||
ALNNO, \
|
||||
16, \
|
||||
FIXEDCHAR, \
|
||||
str8, \
|
||||
Bad, \
|
||||
"EBCDIC " \
|
||||
"Char[16] " \
|
||||
"(16 bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
66, \
|
||||
NzTypeVarCharE, \
|
||||
varE, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varE, \
|
||||
Bad, \
|
||||
"EBCDIC " \
|
||||
"Char " \
|
||||
"Varyin" \
|
||||
"g") \
|
||||
_SEP_ _ROW_( \
|
||||
67, \
|
||||
NzTypeVarFixedCharE, \
|
||||
varE, \
|
||||
FVARY, \
|
||||
0, \
|
||||
VARCHAR, \
|
||||
varE, \
|
||||
Bad, \
|
||||
"EBC" \
|
||||
"DIC" \
|
||||
" Ch" \
|
||||
"ar " \
|
||||
"(us" \
|
||||
"ing" \
|
||||
" va" \
|
||||
"ryi" \
|
||||
"ng" \
|
||||
")") \
|
||||
_SEP_ _ROW_( \
|
||||
68, \
|
||||
NzTypeNumeric4, \
|
||||
int32, \
|
||||
ALN32, \
|
||||
4, \
|
||||
NUMERIC, \
|
||||
int32, \
|
||||
Bad, \
|
||||
"CNumeri" \
|
||||
"c32 (4 " \
|
||||
"bytes)") \
|
||||
_SEP_ _ROW_( \
|
||||
69, \
|
||||
NzTypeNumeric8, \
|
||||
cnum64, \
|
||||
ALN64, \
|
||||
8, \
|
||||
NUMERIC, \
|
||||
cnum64, \
|
||||
Bad, \
|
||||
"CNu" \
|
||||
"mer" \
|
||||
"ic6" \
|
||||
"4 " \
|
||||
"(8 " \
|
||||
"byt" \
|
||||
"es" \
|
||||
")") _SEP_ \
|
||||
_ROW_( \
|
||||
70, \
|
||||
NzTypeNumeric16, \
|
||||
cnum128, \
|
||||
ALN128, \
|
||||
16, \
|
||||
NUMERIC, \
|
||||
cnum128, \
|
||||
Bad, \
|
||||
"CNumeric128 (16 bytes)")
|
||||
|
||||
// Define the EFieldType enumeration
|
||||
#define _ROW_(ORDINAL, ENUMERATOR, REP, ALIGN, FIXED, SCHEMA, ZMACCUM, COMPARE, DESCRIPTION) \
|
||||
ENUMERATOR
|
||||
#define _SEP_ ,
|
||||
enum EFieldType
|
||||
{
|
||||
NZ_FIELD_TYPE_LIST
|
||||
};
|
||||
#undef _ROW_
|
||||
#undef _SEP_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
EFieldType fieldTypeWithSize(EFieldType ft, unsigned bytes, bool padEbcdic);
|
||||
EFieldType fieldTypeWithSize(struct field_t const* f);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // NZFIELDTYPE_H
|
115
nz_include/os.h
Normal file
115
nz_include/os.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
#if (__PPC__) /* NZ */
|
||||
// !FIX-jpb defining this for PPC build (spu.bin target)
|
||||
# define HAVE_INT_TIMEZONE 1
|
||||
#endif
|
||||
|
||||
#if !defined(SUN4S)
|
||||
//
|
||||
// all platforms other than Sparc Solaris
|
||||
//
|
||||
# if defined(__i386__) || defined(__x86_64__)
|
||||
typedef unsigned char slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
|
||||
# elif defined(__powerpc__)
|
||||
typedef unsigned int slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
|
||||
# elif defined(__alpha__)
|
||||
typedef long int slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
|
||||
# elif defined(__mips__)
|
||||
typedef unsigned int slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
|
||||
# elif defined(__arm__)
|
||||
typedef unsigned char slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
|
||||
# elif defined(__ia64__)
|
||||
typedef unsigned int slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
|
||||
# elif defined(__s390__)
|
||||
typedef unsigned int slock_t;
|
||||
|
||||
# define HAS_TEST_AND_SET
|
||||
# endif
|
||||
#else
|
||||
// ====================
|
||||
// For Sparc Solaris
|
||||
// ====================
|
||||
# define HAS_TEST_AND_SET
|
||||
typedef unsigned char slock_t;
|
||||
|
||||
/*
|
||||
* Sort this out for all operting systems some time. The __xxx
|
||||
* symbols are defined on both GCC and Solaris CC, although GCC
|
||||
* doesn't document them. The __xxx__ symbols are only on GCC.
|
||||
*/
|
||||
# if defined(__i386) && !defined(__i386__)
|
||||
# define __i386__
|
||||
# endif
|
||||
|
||||
# if defined(__sparc) && !defined(__sparc__)
|
||||
# define __sparc__
|
||||
# endif
|
||||
|
||||
# if defined(__i386__)
|
||||
# include <sys/isa_defs.h>
|
||||
# endif
|
||||
|
||||
# ifndef BIG_ENDIAN
|
||||
# define BIG_ENDIAN 4321
|
||||
# endif
|
||||
# ifndef LITTLE_ENDIAN
|
||||
# define LITTLE_ENDIAN 1234
|
||||
# endif
|
||||
# ifndef PDP_ENDIAN
|
||||
# define PDP_ENDIAN 3412
|
||||
# endif
|
||||
|
||||
# ifndef BYTE_ORDER
|
||||
# ifdef __sparc__
|
||||
# define BYTE_ORDER BIG_ENDIAN
|
||||
# endif
|
||||
# ifdef __i386__
|
||||
# define BYTE_ORDER LITTLE_ENDIAN
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef NAN
|
||||
|
||||
# if defined(__GNUC__) && defined(__i386__)
|
||||
|
||||
# ifndef __nan_bytes
|
||||
# define __nan_bytes \
|
||||
{ \
|
||||
0, 0, 0, 0, 0, 0, 0xf8, 0x7f \
|
||||
}
|
||||
# endif
|
||||
|
||||
# define NAN \
|
||||
(__extension__((union { \
|
||||
unsigned char __c[8]; \
|
||||
double __d; \
|
||||
}){ __nan_bytes }) \
|
||||
.__d)
|
||||
|
||||
# else
|
||||
/* not GNUC and i386 */
|
||||
|
||||
# define NAN (0.0 / 0.0)
|
||||
|
||||
# endif /* GCC. */
|
||||
|
||||
# endif /* not NAN */
|
||||
|
||||
#endif /* if SUN4S */
|
823
nz_include/pg_config.h
Normal file
823
nz_include/pg_config.h
Normal file
|
@ -0,0 +1,823 @@
|
|||
/*
|
||||
* PostgreSQL configuration-settings file.
|
||||
*
|
||||
* This file was renamed from config.h to pg_config.h -- sanjay
|
||||
*
|
||||
* config.h.in is processed by configure to produce config.h.
|
||||
*
|
||||
* -- this header file has been conditionalized to run on the following
|
||||
* platforms: linux (x86), PPC, Win32 (x86), and Sparc Solaris.
|
||||
*
|
||||
* If you want to modify any of the tweakable settings in Part 2
|
||||
* of this file, you can do it in config.h.in before running configure,
|
||||
* or in config.h afterwards. Of course, if you edit config.h, then your
|
||||
* changes will be overwritten the next time you run configure.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
* Part 1: feature symbols and limits that are set by configure based on
|
||||
* user-supplied switches. This is first so that stuff in Part 2 can
|
||||
* depend on these values.
|
||||
*
|
||||
* Beware of "fixing" configure-time mistakes by editing these values,
|
||||
* since configure may have inserted the settings in other files as well
|
||||
* as here. Best to rerun configure if you forgot --enable-multibyte
|
||||
* or whatever.
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* The version number is actually hard-coded into configure.in */
|
||||
#define PG_VERSION "7.1beta6"
|
||||
/* A canonical string containing the version number, platform, and C compiler */
|
||||
#define PG_VERSION_STR "IBM Netezza SQL Version 1.1" /* NZ */
|
||||
|
||||
#define NZ_VERSION_STR "1.1"
|
||||
|
||||
/* Set to 1 if you want LOCALE support (--enable-locale) */
|
||||
/* #undef USE_LOCALE */
|
||||
|
||||
/* Set to 1 if you want cyrillic recode (--enable-recode) */
|
||||
/* #undef CYR_RECODE */
|
||||
|
||||
/* Set to 1 if you want to use multibyte characters (--enable-multibyte) */
|
||||
/* #undef MULTIBYTE */
|
||||
|
||||
/* Set to 1 if you want Unicode conversion support (--enable-uniconv) */
|
||||
/* #undef UNICODE_CONVERSION */
|
||||
|
||||
/* Set to 1 if you want ASSERT checking (--enable-cassert) */
|
||||
#define USE_ASSERT_CHECKING 1
|
||||
|
||||
/* Define to build with Kerberos 4 support (--with-krb4[=DIR]) */
|
||||
/* #undef KRB4 */
|
||||
|
||||
/* Define to build with Kerberos 5 support (--with-krb5[=DIR]) */
|
||||
/* #undef KRB5 */
|
||||
|
||||
/* Kerberos name of the Postgres service principal (--with-krb-srvnam=NAME) */
|
||||
#define PG_KRB_SRVNAM "netezza"
|
||||
|
||||
/* Define to build with (Open)SSL support (--with-openssl[=DIR]) */
|
||||
/* #undef USE_SSL */
|
||||
|
||||
/*
|
||||
* DEF_PGPORT is the TCP port number on which the Postmaster listens and
|
||||
* which clients will try to connect to. This is just a default value;
|
||||
* it can be overridden at postmaster or client startup. It's awfully
|
||||
* convenient if your clients have the right default compiled in, though.
|
||||
* (--with-pgport=PORTNUM)
|
||||
*/
|
||||
#define DEF_PGPORT 5480
|
||||
/* ... and once more as a string constant instead */
|
||||
#define DEF_PGPORT_STR "5480"
|
||||
|
||||
/*
|
||||
* Default soft limit on number of backend server processes per postmaster;
|
||||
* this is just the default setting for the postmaster's -N switch.
|
||||
* (--with-maxbackends=N)
|
||||
*/
|
||||
#define DEF_MAXBACKENDS 120
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
* Part 2: feature symbols and limits that are user-configurable, but
|
||||
* only by editing this file ... there's no configure support for them.
|
||||
*
|
||||
* Editing this file and doing a full rebuild (and an initdb if noted)
|
||||
* should be sufficient to change any of these.
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Hard limit on number of backend server processes per postmaster.
|
||||
* Increasing this costs about 32 bytes per process slot as of v 6.5.
|
||||
*/
|
||||
#define MAXBACKENDS (DEF_MAXBACKENDS > 2048 ? DEF_MAXBACKENDS : 2048)
|
||||
|
||||
/*
|
||||
* Default number of buffers in shared buffer pool (each of size BLCKSZ).
|
||||
* This is just the default setting for the postmaster's -B switch.
|
||||
* Perhaps it ought to be configurable from a configure switch.
|
||||
* NOTE: default setting corresponds to the minimum number of buffers
|
||||
* that postmaster.c will allow for the default MaxBackends value.
|
||||
*/
|
||||
#define DEF_NBUFFERS (DEF_MAXBACKENDS > 8 ? DEF_MAXBACKENDS * 2 : 16)
|
||||
|
||||
/*
|
||||
* Size of a disk block --- this also limits the size of a tuple.
|
||||
* You can set it bigger if you need bigger tuples (although TOAST
|
||||
* should reduce the need to have large tuples, since fields can now
|
||||
* be spread across multiple tuples).
|
||||
*
|
||||
* The maximum possible value of BLCKSZ is currently 2^15 (32768).
|
||||
* This is determined by the 15-bit widths of the lp_off and lp_len
|
||||
* fields in ItemIdData (see include/storage/itemid.h).
|
||||
*
|
||||
* CAUTION: changing BLCKSZ requires an initdb.
|
||||
*/
|
||||
// NZ #define BLCKSZ 8192
|
||||
#define BLCKSZ 16384
|
||||
|
||||
/*
|
||||
* RELSEG_SIZE is the maximum number of blocks allowed in one disk file.
|
||||
* Thus, the maximum size of a single file is RELSEG_SIZE * BLCKSZ;
|
||||
* relations bigger than that are divided into multiple files.
|
||||
*
|
||||
* CAUTION: RELSEG_SIZE * BLCKSZ must be less than your OS' limit on file
|
||||
* size. This is typically 2Gb or 4Gb in a 32-bit operating system. By
|
||||
* default, we make the limit 1Gb to avoid any possible integer-overflow
|
||||
* problems within the OS. A limit smaller than necessary only means we
|
||||
* divide a large relation into more chunks than necessary, so it seems
|
||||
* best to err in the direction of a small limit. (Besides, a power-of-2
|
||||
* value saves a few cycles in md.c.)
|
||||
*
|
||||
* CAUTION: changing RELSEG_SIZE requires an initdb.
|
||||
*/
|
||||
#define RELSEG_SIZE (0x40000000 / BLCKSZ)
|
||||
|
||||
/*
|
||||
* Maximum number of columns in an index and maximum number of arguments
|
||||
* to a function. They must be the same value.
|
||||
*
|
||||
* The minimum value is 8 (index creation uses 8-argument functions).
|
||||
* There is no specific upper limit, although large values will waste
|
||||
* system-table space and processing time.
|
||||
*
|
||||
* CAUTION: changing these requires an initdb.
|
||||
*
|
||||
* BTW: if you need to call dynamically-loaded old-style C functions that
|
||||
* have more than 16 arguments, you will also need to add cases to the
|
||||
* switch statement in fmgr_oldstyle() in src/backend/utils/fmgr/fmgr.c.
|
||||
* But consider converting such functions to new-style instead...
|
||||
*/
|
||||
#define INDEX_MAX_KEYS 64
|
||||
#define FUNC_MAX_ARGS INDEX_MAX_KEYS
|
||||
|
||||
/*
|
||||
* Define this to make libpgtcl's "pg_result -assign" command process C-style
|
||||
* backslash sequences in returned tuple data and convert Postgres array
|
||||
* attributes into Tcl lists. CAUTION: this conversion is *wrong* unless
|
||||
* you install the routines in contrib/string/string_io to make the backend
|
||||
* produce C-style backslash sequences in the first place.
|
||||
*/
|
||||
/* #define TCL_ARRAYS */
|
||||
|
||||
/*
|
||||
* User locks are handled totally on the application side as long term
|
||||
* cooperative locks which extend beyond the normal transaction boundaries.
|
||||
* Their purpose is to indicate to an application that someone is `working'
|
||||
* on an item. Define this flag to enable user locks. You will need the
|
||||
* loadable module user-locks.c to use this feature.
|
||||
*/
|
||||
#define USER_LOCKS
|
||||
|
||||
/*
|
||||
* Define this if you want psql to _always_ ask for a username and a password
|
||||
* for password authentication.
|
||||
*/
|
||||
/* #define PSQL_ALWAYS_GET_PASSWORDS */
|
||||
|
||||
/*
|
||||
* Define this if you want to allow the lo_import and lo_export SQL functions
|
||||
* to be executed by ordinary users. By default these functions are only
|
||||
* available to the Postgres superuser. CAUTION: these functions are
|
||||
* SECURITY HOLES since they can read and write any file that the Postgres
|
||||
* backend has permission to access. If you turn this on, don't say we
|
||||
* didn't warn you.
|
||||
*/
|
||||
/* #define ALLOW_DANGEROUS_LO_FUNCTIONS */
|
||||
|
||||
/*
|
||||
* Use btree bulkload code:
|
||||
* this code is moderately slow (~10% slower) compared to the regular
|
||||
* btree (insertion) build code on sorted or well-clustered data. on
|
||||
* random data, however, the insertion build code is unusable -- the
|
||||
* difference on a 60MB heap is a factor of 15 because the random
|
||||
* probes into the btree thrash the buffer pool.
|
||||
*
|
||||
* Great thanks to Paul M. Aoki (aoki@CS.Berkeley.EDU)
|
||||
*/
|
||||
#define FASTBUILD /* access/nbtree/nbtsort.c */
|
||||
|
||||
/*
|
||||
* MAXPGPATH: standard size of a pathname buffer in Postgres (hence,
|
||||
* maximum usable pathname length is one less).
|
||||
*
|
||||
* We'd use a standard system header symbol for this, if there weren't
|
||||
* so many to choose from: MAXPATHLEN, _POSIX_PATH_MAX, MAX_PATH, PATH_MAX
|
||||
* are all defined by different "standards", and often have different
|
||||
* values on the same platform! So we just punt and use a reasonably
|
||||
* generous setting here.
|
||||
*/
|
||||
#define MAXPGPATH 1024
|
||||
|
||||
/*
|
||||
* DEFAULT_MAX_EXPR_DEPTH: default value of max_expr_depth SET variable.
|
||||
*/
|
||||
#define DEFAULT_MAX_EXPR_DEPTH 10000
|
||||
|
||||
/*
|
||||
* You can try changing this if you have a machine with bytes of another
|
||||
* size, but no guarantee...
|
||||
*/
|
||||
#define BITS_PER_BYTE 8
|
||||
|
||||
/*
|
||||
* Define this if your operating system supports AF_UNIX family sockets.
|
||||
*/
|
||||
#if !defined(__QNX__) && !defined(__BEOS__)
|
||||
# define HAVE_UNIX_SOCKETS 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is the default directory in which AF_UNIX socket files are placed.
|
||||
* Caution: changing this risks breaking your existing client applications,
|
||||
* which are likely to continue to look in the old directory. But if you
|
||||
* just hate the idea of sockets in /tmp, here's where to twiddle it.
|
||||
* You can also override this at runtime with the postmaster's -k switch.
|
||||
*/
|
||||
#define DEFAULT_PGSOCKET_DIR "/tmp"
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
* These hand-configurable symbols are for enabling debugging code,
|
||||
* not for controlling user-visible features or resource limits.
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Define this to cause pfree()'d memory to be cleared immediately,
|
||||
* to facilitate catching bugs that refer to already-freed values.
|
||||
* XXX For 7.1 development, define this automatically if --enable-cassert.
|
||||
* In the long term it probably doesn't need to be on by default.
|
||||
*/
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
# define CLOBBER_FREED_MEMORY
|
||||
#endif
|
||||
|
||||
/* Define this to check memory allocation errors (scribbling on more
|
||||
* bytes than were allocated).
|
||||
* XXX For 7.1 development, define this automatically if --enable-cassert.
|
||||
* In the long term it probably doesn't need to be on by default.
|
||||
*/
|
||||
#ifdef USE_ASSERT_CHECKING
|
||||
# define MEMORY_CONTEXT_CHECKING
|
||||
#endif
|
||||
|
||||
/* Define this to force all parse and plan trees to be passed through
|
||||
* copyObject(), to facilitate catching errors and omissions in copyObject().
|
||||
*/
|
||||
/* #define COPY_PARSE_PLAN_TREES */
|
||||
|
||||
/* Enable debugging print statements in the date/time support routines. */
|
||||
/* #define DATEDEBUG */
|
||||
|
||||
/* Enable debugging print statements for lock-related operations. */
|
||||
#define LOCK_DEBUG
|
||||
|
||||
/*
|
||||
* Other debug #defines (documentation, anyone?)
|
||||
*/
|
||||
/* #define IPORTAL_DEBUG */
|
||||
/* #define HEAPDEBUGALL */
|
||||
/* #define ISTRATDEBUG */
|
||||
/* #define ACLDEBUG */
|
||||
/* #define RTDEBUG */
|
||||
/* #define GISTDEBUG */
|
||||
/* #define OMIT_PARTIAL_INDEX */
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
* Part 3: system configuration information that is auto-detected by
|
||||
* configure. In theory you shouldn't have to touch any of this stuff
|
||||
* by hand. In the real world, configure might get it wrong...
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* Define const as empty if your compiler doesn't grok const. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define as your compiler's spelling of "inline", or empty if no inline. */
|
||||
/* #undef inline */
|
||||
|
||||
/* Define as empty if the C compiler doesn't understand "signed". */
|
||||
/* #undef signed */
|
||||
|
||||
/* Define as empty if the C compiler doesn't understand "volatile". */
|
||||
/* #undef volatile */
|
||||
|
||||
/* Define if your cpp understands the ANSI stringizing operators in macros */
|
||||
#define HAVE_STRINGIZE 1
|
||||
|
||||
/* Set to 1 if you have <crypt.h> */
|
||||
#if !WIN32
|
||||
# define HAVE_CRYPT_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <dld.h> */
|
||||
/* #undef HAVE_DLD_H */
|
||||
|
||||
/* Set to 1 if you have <endian.h> */
|
||||
#if !WIN32 && !SUN4S && !SUNIS && !HPITANIUM
|
||||
# define HAVE_ENDIAN_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <fp_class.h> */
|
||||
/* #undef HAVE_FP_CLASS_H */
|
||||
|
||||
/* Set to 1 if you have <getopt.h> */
|
||||
#if LINUX
|
||||
# define HAVE_GETOPT_H 1
|
||||
#else
|
||||
/* #undef HAVE_GETOPT_H */
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <history.h> */
|
||||
/* #undef HAVE_HISTORY_H */
|
||||
|
||||
/* Set to 1 if you have <ieeefp.h> */
|
||||
#if SUN4S
|
||||
# define HAVE_IEEEFP_H 1
|
||||
#else
|
||||
/* #undef HAVE_IEEEFP_H */
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <netinet/tcp.h> */
|
||||
#define HAVE_NETINET_TCP_H 1
|
||||
|
||||
/* Set to 1 if you have <readline.h> */
|
||||
/* #undef HAVE_READLINE_H */
|
||||
|
||||
/* Set to 1 if you have <readline/history.h> */
|
||||
#if !WIN32
|
||||
# define HAVE_READLINE_HISTORY_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <readline/readline.h> */
|
||||
#if !WIN32
|
||||
# define HAVE_READLINE_READLINE_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <sys/ipc.h> */
|
||||
#if !WIN32
|
||||
# define HAVE_SYS_IPC_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <sys/select.h> */
|
||||
#if !WIN32 && !HP800 && !HPITANIUM
|
||||
# define HAVE_SYS_SELECT_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <sys/un.h> */
|
||||
#define HAVE_SYS_UN_H 1
|
||||
|
||||
/* Set to 1 if you have <sys/sem.h> */
|
||||
#define HAVE_SYS_SEM_H 1
|
||||
|
||||
/* Set to 1 if you have <sys/shm.h> */
|
||||
#define HAVE_SYS_SHM_H 1
|
||||
|
||||
/* Set to 1 if you have <kernel/OS.h> */
|
||||
/* #undef HAVE_KERNEL_OS_H */
|
||||
|
||||
/* Set to 1 if you have <SupportDefs.h> */
|
||||
/* #undef HAVE_SUPPORTDEFS_H */
|
||||
|
||||
/* Set to 1 if you have <kernel/image.h> */
|
||||
/* #undef HAVE_KERNEL_IMAGE_H */
|
||||
|
||||
/* Set to 1 if you have <termios.h> */
|
||||
#if !WIN32
|
||||
# define HAVE_TERMIOS_H 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have <sys/pstat.h> */
|
||||
/* #undef HAVE_SYS_PSTAT_H */
|
||||
|
||||
/* Define if string.h and strings.h may both be included */
|
||||
#if !WIN32
|
||||
# define STRING_H_WITH_STRINGS_H 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the setproctitle function. */
|
||||
/* #undef HAVE_SETPROCTITLE */
|
||||
|
||||
/* Define if you have the pstat function. */
|
||||
/* #undef HAVE_PSTAT */
|
||||
|
||||
/* Define if the PS_STRINGS thing exists. */
|
||||
/* #undef HAVE_PS_STRINGS */
|
||||
|
||||
/* Define if you have the stricmp function. */
|
||||
/* #undef HAVE_STRICMP */
|
||||
|
||||
/* Set to 1 if you have history functions (either in libhistory or libreadline) */
|
||||
#define HAVE_HISTORY_FUNCTIONS 1
|
||||
|
||||
/* Set to 1 if you have <pwd.h> */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Set to 1 if you have gettimeofday(a) instead of gettimeofday(a,b) */
|
||||
/* #undef GETTIMEOFDAY_1ARG */
|
||||
#ifdef GETTIMEOFDAY_1ARG
|
||||
# define gettimeofday(a, b) gettimeofday(a)
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have snprintf() in the C library */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Set to 1 if your standard system headers declare snprintf() */
|
||||
#define HAVE_SNPRINTF_DECL 1
|
||||
|
||||
/* Set to 1 if you have vsnprintf() in the C library */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Set to 1 if your standard system headers declare vsnprintf() */
|
||||
#define HAVE_VSNPRINTF_DECL 1
|
||||
|
||||
/* Set to 1 if you have strerror() */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Set to 1 if you have isinf() */
|
||||
#if !SUN4S && !SUNIS
|
||||
# define HAVE_ISINF 1
|
||||
#endif
|
||||
#ifndef HAVE_ISINF
|
||||
extern int isinf(double x);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These are all related to port/isinf.c
|
||||
*/
|
||||
/* #undef HAVE_FPCLASS */
|
||||
/* #undef HAVE_FP_CLASS */
|
||||
/* #undef HAVE_FP_CLASS_H */
|
||||
/* #undef HAVE_FP_CLASS_D */
|
||||
/* #undef HAVE_CLASS */
|
||||
|
||||
/* Set to 1 if you have gethostname() */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
#ifndef HAVE_GETHOSTNAME
|
||||
extern int gethostname(char *name, int namelen);
|
||||
#endif
|
||||
|
||||
/* Set to 1 if struct tm has a tm_zone member */
|
||||
#if !__PPC__ // !FIX-bmz hack
|
||||
# if defined(LINUX)
|
||||
# define HAVE_TM_ZONE 1
|
||||
# elif defined(SUN4S)
|
||||
# define HAVE_INT_TIMEZONE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have int timezone.
|
||||
* NOTE: if both tm_zone and a global timezone variable exist,
|
||||
* usingclause the tm_zone field should probably be preferred,
|
||||
* since global variables are inherently not thread-safe.
|
||||
*/
|
||||
#if __PPC__ // !FIX-bmz hack
|
||||
# define HAVE_INT_TIMEZONE 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have cbrt() */
|
||||
#define HAVE_CBRT 1
|
||||
|
||||
/* Set to 1 if you have inet_aton() */
|
||||
#if !HP800 && !HPITANIUM
|
||||
# define HAVE_INET_ATON 1
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INET_ATON
|
||||
# include <sys/types.h>
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
extern int inet_aton(const char *cp, struct in_addr *addr);
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have fcvt() */
|
||||
#define HAVE_FCVT 1
|
||||
|
||||
/* Set to 1 if you have rint() */
|
||||
#define HAVE_RINT 1
|
||||
|
||||
/* Set to 1 if you have finite() */
|
||||
#if !HP800 && !HPITANIUM
|
||||
# define HAVE_FINITE 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have memmove() */
|
||||
#define HAVE_MEMMOVE 1
|
||||
|
||||
/* Set to 1 if you have sigsetjmp() */
|
||||
#define HAVE_SIGSETJMP 1
|
||||
|
||||
/*
|
||||
* When there is no sigsetjmp, its functionality is provided by plain
|
||||
* setjmp. Incidentally, nothing provides setjmp's functionality in
|
||||
* that case.
|
||||
*/
|
||||
#ifndef HAVE_SIGSETJMP
|
||||
# define sigjmp_buf jmp_buf
|
||||
# define sigsetjmp(x, y) setjmp(x)
|
||||
# define siglongjmp longjmp
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have sysconf() */
|
||||
#define HAVE_SYSCONF 1
|
||||
|
||||
/* Set to 1 if you have getrusage() */
|
||||
#define HAVE_GETRUSAGE 1
|
||||
|
||||
/* Set to 1 if you have waitpid() */
|
||||
#define HAVE_WAITPID 1
|
||||
|
||||
/* Set to 1 if you have setsid() */
|
||||
#define HAVE_SETSID 1
|
||||
|
||||
/* Set to 1 if you have sigprocmask() */
|
||||
#define HAVE_SIGPROCMASK 1
|
||||
|
||||
/* Set to 1 if you have sigprocmask() */
|
||||
#define HAVE_STRCASECMP 1
|
||||
#ifndef HAVE_STRCASECMP
|
||||
extern int strcasecmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have strtol() */
|
||||
#define HAVE_STRTOL 1
|
||||
|
||||
/* Set to 1 if you have strtoul() */
|
||||
#define HAVE_STRTOUL 1
|
||||
|
||||
/* Set to 1 if you have strdup() */
|
||||
#define HAVE_STRDUP 1
|
||||
#ifndef HAVE_STRDUP
|
||||
extern char *strdup(char const *);
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have random() */
|
||||
#define HAVE_RANDOM 1
|
||||
#ifndef HAVE_RANDOM
|
||||
extern long random(void);
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have srandom() */
|
||||
#define HAVE_SRANDOM 1
|
||||
#ifndef HAVE_SRANDOM
|
||||
extern void srandom(unsigned int seed);
|
||||
#endif
|
||||
|
||||
/* The random() function is expected to yield values 0 .. MAX_RANDOM_VALUE */
|
||||
/* Currently, all known implementations yield 0..2^31-1, so we just hardwire
|
||||
* this constant. We could do a configure test if it proves to be necessary.
|
||||
* CAUTION: Think not to replace this with RAND_MAX. RAND_MAX defines the
|
||||
* maximum value of the older rand() function, which is often different from
|
||||
* --- and considerably inferior to --- random().
|
||||
*/
|
||||
#define MAX_RANDOM_VALUE (0x7FFFFFFF)
|
||||
|
||||
/* Define if you have dlopen() */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define if you have fdatasync() */
|
||||
#if !SUN4S
|
||||
# define HAVE_FDATASYNC 1
|
||||
#endif
|
||||
|
||||
/* Define if the standard header unistd.h declares fdatasync() */
|
||||
#define HAVE_FDATASYNC_DECL 1
|
||||
|
||||
#if defined(HAVE_FDATASYNC) && !defined(HAVE_FDATASYNC_DECL)
|
||||
extern int fdatasync(int fildes);
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have libz.a */
|
||||
#if SUN4S
|
||||
/* #undef HAVE_LIBZ */
|
||||
#else
|
||||
# define HAVE_LIBZ 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have libreadline.a */
|
||||
#define HAVE_LIBREADLINE 1
|
||||
|
||||
/* Set to 1 if you have libhistory.a */
|
||||
/* #undef HAVE_LIBHISTORY */
|
||||
|
||||
/* Set to 1 if your libreadline defines rl_completion_append_character */
|
||||
#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
|
||||
|
||||
/* Set to 1 if filename_completion_function is declared in the readline header */
|
||||
#define HAVE_FILENAME_COMPLETION_FUNCTION_DECL 1
|
||||
|
||||
/* Set to 1 if you have getopt_long() (GNU long options) */
|
||||
#if !SUN4S
|
||||
# define HAVE_GETOPT_LONG 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if you have union semun */
|
||||
/* #undef HAVE_UNION_SEMUN */
|
||||
|
||||
/* Set to 1 if you have struct sockaddr_un */
|
||||
#if !WIN32
|
||||
# define HAVE_STRUCT_SOCKADDR_UN 1
|
||||
#endif
|
||||
|
||||
/* Set to 1 if type "long int" works and is 64 bits */
|
||||
/* #undef HAVE_LONG_INT_64 */
|
||||
|
||||
/* Set to 1 if type "long long int" works and is 64 bits */
|
||||
#define HAVE_LONG_LONG_INT_64
|
||||
|
||||
/* Set to 1 if type "long long int" constants should be suffixed by LL */
|
||||
#if SUN4S
|
||||
# define HAVE_LL_CONSTANTS 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These must be defined as the alignment requirement (NOT the size) of
|
||||
* each of the basic C data types (except char, which we assume has align 1).
|
||||
* MAXIMUM_ALIGNOF is the largest alignment requirement for any C data type.
|
||||
* ALIGNOF_LONG_LONG_INT need only be defined if HAVE_LONG_LONG_INT_64 is.
|
||||
*/
|
||||
#define ALIGNOF_SHORT 2
|
||||
#define ALIGNOF_INT 4
|
||||
#define ALIGNOF_LONG 4
|
||||
#if SUN4S || (HPITANIUM && defined(__LP64__))
|
||||
# define ALIGNOF_LONG_LONG_INT 8
|
||||
# define ALIGNOF_DOUBLE 8
|
||||
# define MAXIMUM_ALIGNOF 8
|
||||
#else
|
||||
# define ALIGNOF_LONG_LONG_INT 4
|
||||
# define ALIGNOF_DOUBLE 4
|
||||
# define MAXIMUM_ALIGNOF 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 64 bit compatibility - below
|
||||
* we use sizes appropriate for LP64 data model
|
||||
*/
|
||||
|
||||
#undef ALIGNOF_DOUBLE
|
||||
#ifdef __x86_64__
|
||||
# define ALIGNOF_DOUBLE 8
|
||||
#else
|
||||
# define ALIGNOF_DOUBLE 4
|
||||
#endif
|
||||
#undef ALIGNOF_LONG
|
||||
#ifdef __x86_64__
|
||||
# define ALIGNOF_LONG 8
|
||||
#else
|
||||
# define ALIGNOF_LONG 4
|
||||
#endif
|
||||
#undef ALIGNOF_LONG_LONG_INT
|
||||
#ifndef __x86_64__
|
||||
# define ALIGNOF_LONG_LONG_INT 4
|
||||
#endif
|
||||
#undef FLOAT8PASSBYVAL
|
||||
#ifdef __x86_64__
|
||||
# define FLOAT8PASSBYVAL true
|
||||
#else
|
||||
# define FLOAT8PASSBYVAL false
|
||||
#endif
|
||||
#undef HAVE_LL_CONSTANTS
|
||||
#ifndef __x86_64__
|
||||
# define HAVE_LL_CONSTANTS 1
|
||||
#endif
|
||||
#undef HAVE_LONG_INT_64
|
||||
#undef HAVE_LONG_LONG_INT_64
|
||||
#ifdef __x86_64__
|
||||
# define HAVE_LONG_INT_64 1
|
||||
#else
|
||||
# define HAVE_LONG_LONG_INT_64 1
|
||||
#endif
|
||||
#undef INT64_FORMAT
|
||||
#define INT64_FORMAT "%" PRId64 ""
|
||||
#undef MAXIMUM_ALIGNOF
|
||||
#if defined(__x86_64__) || (HPITANIUM && defined(__LP64__)) || SUN4S
|
||||
# define MAXIMUM_ALIGNOF 8
|
||||
#else
|
||||
# define MAXIMUM_ALIGNOF 4
|
||||
#endif
|
||||
#undef SIZEOF_SIZE_T
|
||||
#ifdef __x86_64__
|
||||
# define SIZEOF_SIZE_T 8
|
||||
#else
|
||||
# define SIZEOF_SIZE_T 4
|
||||
#endif
|
||||
#undef SIZEOF_UNSIGNED_LONG
|
||||
#ifdef __x86_64__
|
||||
# define SIZEOF_UNSIGNED_LONG 8
|
||||
#else
|
||||
# define SIZEOF_UNSIGNED_LONG 4
|
||||
#endif
|
||||
#undef UINT64_FORMAT
|
||||
#define UINT64_FORMAT "%" PRIu64 ""
|
||||
#undef USE_FLOAT8_BYVAL
|
||||
#ifdef __x86_64__
|
||||
# define USE_FLOAT8_BYVAL 1
|
||||
#endif
|
||||
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
/* end of 64 bit compatibility */
|
||||
|
||||
/* Define as the type of the 3rd argument to accept() */
|
||||
|
||||
/*
|
||||
* :host64: possible change
|
||||
*
|
||||
* it might be needed to change the ACCEPT_TYPE_ARG3 to socklen_t
|
||||
* due to changed accept prototype. We should rely
|
||||
* on socklen_t type from socket.h
|
||||
*
|
||||
* extern int accept (int __fd, __SOCKADDR_ARG __addr,
|
||||
* socklen_t *__restrict __addr_len);
|
||||
*/
|
||||
|
||||
#if SUN4S || HPITANIUM
|
||||
# define ACCEPT_TYPE_ARG3 int
|
||||
#else
|
||||
# define ACCEPT_TYPE_ARG3 socklen_t // :host64:
|
||||
#endif
|
||||
|
||||
/* Define if POSIX signal interface is available */
|
||||
#if !WIN32
|
||||
# define HAVE_POSIX_SIGNALS
|
||||
#endif
|
||||
|
||||
/* Define if C++ compiler accepts "usingclause namespace std" */
|
||||
/* #undef HAVE_NAMESPACE_STD */
|
||||
|
||||
/* Define if C++ compiler accepts "#include <string>" */
|
||||
/* #undef HAVE_CXX_STRING_HEADER */
|
||||
|
||||
/* Define if you have the optreset variable */
|
||||
/* #undef HAVE_INT_OPTRESET */
|
||||
|
||||
/* Define if you have strtoll() */
|
||||
#if !HP800 && !AIX && !HPITANIUM
|
||||
# define HAVE_STRTOLL 1
|
||||
#endif
|
||||
|
||||
/* Define if you have strtoq() */
|
||||
/* #undef HAVE_STRTOQ */
|
||||
|
||||
/* If strtoq() exists, rename it to the more standard strtoll() */
|
||||
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
|
||||
# define strtoll strtoq
|
||||
# define HAVE_STRTOLL 1
|
||||
#endif
|
||||
|
||||
/* Define if you have strtoull() */
|
||||
#define HAVE_STRTOULL 1
|
||||
|
||||
/* Define if you have strtouq() */
|
||||
/* #undef HAVE_STRTOUQ */
|
||||
|
||||
/* If strtouq() exists, rename it to the more standard strtoull() */
|
||||
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
|
||||
# define strtoull strtouq
|
||||
# define HAVE_STRTOULL 1
|
||||
#endif
|
||||
|
||||
/* Define if you have atexit() */
|
||||
#define HAVE_ATEXIT 1
|
||||
|
||||
/* Define if you have on_exit() */
|
||||
/* #undef HAVE_ON_EXIT */
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
* Part 4: pull in system-specific declarations.
|
||||
*
|
||||
* This is still configure's responsibility, because it picks where
|
||||
* the "os.h" symlink points...
|
||||
*------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pull in OS-specific declarations (usingclause link created by configure)
|
||||
*/
|
||||
|
||||
#include "os.h"
|
||||
|
||||
/*
|
||||
* The following is used as the arg list for signal handlers. Any ports
|
||||
* that take something other than an int argument should override this in
|
||||
* the port-specific os.h file. Note that variable names are required
|
||||
* because it is used in both the prototypes as well as the definitions.
|
||||
* Note also the long name. We expect that this won't collide with
|
||||
* other names causing compiler warnings.
|
||||
*/
|
||||
|
||||
#ifndef SIGNAL_ARGS
|
||||
# define SIGNAL_ARGS int postgres_signal_arg
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_H */
|
88
nz_include/postgres_ext.h
Normal file
88
nz_include/postgres_ext.h
Normal file
|
@ -0,0 +1,88 @@
|
|||
#ifndef POSTGRES_EXT_H
|
||||
#define POSTGRES_EXT_H
|
||||
/// @file postgres_ext.h
|
||||
/// @brief Definitions shared between postgres and other parts of NPS
|
||||
///
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/// Copyright (c) 2008 Netezza Corporation.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
///
|
||||
/// Description:
|
||||
///
|
||||
///
|
||||
///
|
||||
/// postgres_ext.h
|
||||
///
|
||||
/// This file contains declarations of things that are visible everywhere
|
||||
/// in PostgreSQL *and* are visible to clients of frontend interface libraries.
|
||||
/// For example, the Oid type is part of the API of libpq and other libraries.
|
||||
///
|
||||
/// Declarations which are specific to a particular interface should
|
||||
/// go in the header file for that interface (such as libpq-fe.h). This
|
||||
/// file is only for fundamental Postgres declarations.
|
||||
///
|
||||
/// User-written C functions don't count as "external to Postgres."
|
||||
/// Those function much as local modifications to the backend itself, and
|
||||
/// use header files that are otherwise internal to Postgres to interface
|
||||
/// with the backend.
|
||||
///
|
||||
///
|
||||
///
|
||||
/// dd - 2008-02-07
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "limits.h"
|
||||
|
||||
// :host64:
|
||||
#include "comtypes.h"
|
||||
|
||||
#define InvalidOid ((Oid) 0)
|
||||
|
||||
/*
|
||||
* NAMEDATALEN is the max length for system identifiers (e.g. table names,
|
||||
* attribute names, function names, etc.)
|
||||
*
|
||||
* NOTE that databases with different NAMEDATALEN's cannot interoperate!
|
||||
*/
|
||||
#define NAMEDATALEN 256 // supported length for database object names is 128 UTF-8 characters
|
||||
#define MAX_IDENTIFIER 128 // supported number of characters for database object names
|
||||
#define MAX_CFIELD 512 // supported number of characters for client info field names
|
||||
#define MAX_BYTES_PER_NCHAR 4
|
||||
#define CFIELDDATALEN \
|
||||
(MAX_CFIELD * MAX_BYTES_PER_NCHAR) // supported length for client information fields
|
||||
#define MAX_SYSOID 200000
|
||||
#define NUM_BASE_VIEW_ATTRS 6
|
||||
#define NUM_ROW_SECURE_ATTRS 4
|
||||
#define MAX_PASSWORD_LENGTH 2048 // maximum password length
|
||||
|
||||
/*
|
||||
* StrNCpy
|
||||
* Like standard library function strncpy(), except that result string
|
||||
* is guaranteed to be null-terminated --- that is, at most N-1 bytes
|
||||
* of the source string will be kept.
|
||||
* Also, the macro returns no result (too hard to do that without
|
||||
* evaluating the arguments multiple times, which seems worse).
|
||||
*
|
||||
* BTW: when you need to copy a non-null-terminated string (like a text
|
||||
* datum) and add a null, do not do it with StrNCpy(..., len+1). That
|
||||
* might seem to work, but it fetches one byte more than there is in the
|
||||
* text object. One fine day you'll have a SIGSEGV because there isn't
|
||||
* another byte before the end of memory. Don't laugh, we've had real
|
||||
* live bug reports from real live users over exactly this mistake.
|
||||
* Do it honestly with "memcpy(dst,src,len); dst[len] = '\0';", instead.
|
||||
*/
|
||||
#ifdef StrNCpy
|
||||
# undef StrNCpy
|
||||
#endif
|
||||
#define StrNCpy(dst, src, len) \
|
||||
do { \
|
||||
char* _dst = (dst); \
|
||||
int _len = (len); \
|
||||
\
|
||||
if (_len > 0) { \
|
||||
strncpy(_dst, (src), _len); \
|
||||
_dst[_len - 1] = '\0'; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
BIN
nz_lib/libnzpq.so
Executable file
BIN
nz_lib/libnzpq.so
Executable file
Binary file not shown.
|
@ -102,7 +102,7 @@ struct connectionObject {
|
|||
int server_version; /* server version */
|
||||
|
||||
PGconn *pgconn; /* the postgresql connection */
|
||||
PGcancel *cancel; /* the cancellation structure */
|
||||
int *cancel; /* the cancellation structure */
|
||||
|
||||
/* Weakref to the object executing an asynchronous query. The object
|
||||
* is a cursor for async connections, but it may be something else
|
||||
|
|
7
setup.py
7
setup.py
|
@ -339,6 +339,9 @@ For further information please check the 'doc/src/install.rst' file (also at
|
|||
def finalize_linux(self):
|
||||
"""Finalize build system configuration on GNU/Linux platform."""
|
||||
# tell piro that GCC is fine and dandy, but not so MS compilers
|
||||
self.libraries.append("krb5")
|
||||
self.libraries.append("ssl")
|
||||
self.libraries.append("k5crypto")
|
||||
for extension in self.extensions:
|
||||
extension.extra_compile_args.append(
|
||||
'-Wdeclaration-after-statement')
|
||||
|
@ -358,16 +361,18 @@ For further information please check the 'doc/src/install.rst' file (also at
|
|||
pg_config_helper = PostgresConfig(self)
|
||||
|
||||
self.include_dirs.append(".")
|
||||
self.include_dirs.append("./nz_include")
|
||||
if self.static_libpq:
|
||||
if not getattr(self, 'link_objects', None):
|
||||
self.link_objects = []
|
||||
self.link_objects.append(
|
||||
os.path.join(pg_config_helper.query("libdir"), "libpq.a"))
|
||||
else:
|
||||
self.libraries.append("pq")
|
||||
self.libraries.append("nzpq")
|
||||
|
||||
try:
|
||||
self.library_dirs.append(pg_config_helper.query("libdir"))
|
||||
self.library_dirs.append("./nz_lib")
|
||||
self.include_dirs.append(pg_config_helper.query("includedir"))
|
||||
self.include_dirs.append(pg_config_helper.query("includedir-server"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user