2010-10-24 03:12:37 +04:00
|
|
|
/*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef POSTGRESQL_H
|
|
|
|
#define POSTGRESQL_H
|
|
|
|
|
|
|
|
#define PG_OID_INT8 20
|
|
|
|
#define PG_OID_INT4 23
|
|
|
|
|
2018-03-17 01:02:07 +03:00
|
|
|
#if HAVE_BYTESWAP
|
2010-10-25 16:22:22 +04:00
|
|
|
#include <byteswap.h>
|
2018-03-17 01:02:07 +03:00
|
|
|
#define PG_BSWAP32(x) bswap_32(x)
|
|
|
|
#define PG_BSWAP64(x) bswap_64(x)
|
|
|
|
#elif HAVE_SYS_ENDIAN
|
2017-02-13 16:30:48 +03:00
|
|
|
#include <sys/endian.h>
|
2018-03-17 01:02:07 +03:00
|
|
|
#define PG_BSWAP32(x) bswap32(x)
|
|
|
|
#define PG_BSWAP64(x) bswap64(x)
|
|
|
|
#else
|
|
|
|
#error "No appropriate byteswap found for your system."
|
2017-02-13 16:30:48 +03:00
|
|
|
#endif
|
2010-10-25 16:22:22 +04:00
|
|
|
|
2018-03-17 01:02:07 +03:00
|
|
|
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
|
|
#define PGint32(x) (x)
|
|
|
|
#define PGint64(x) (x)
|
|
|
|
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
|
|
#define PGint32(x) PG_BSWAP32(x)
|
|
|
|
#define PGint64(x) PG_BSWAP64(x)
|
|
|
|
#elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)
|
2010-10-24 03:12:37 +04:00
|
|
|
#define PGint32(x) (x)
|
|
|
|
#define PGint64(x) (x)
|
2018-03-17 01:02:07 +03:00
|
|
|
#elif defined(_BYTE_ORDER) && (_BYTE_ORDER == _LITTLE_ENDIAN)
|
|
|
|
#define PGint32(x) PG_BSWAP32(x)
|
|
|
|
#define PGint64(x) PG_BSWAP64(x)
|
2010-10-24 03:12:37 +04:00
|
|
|
#else
|
2018-03-17 01:02:07 +03:00
|
|
|
#error "Cannot determine byte order."
|
2010-10-24 03:12:37 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
const char *build_conninfo(const char *db, const char *username, const char *password, const char *host, const char *port);
|
|
|
|
|
|
|
|
#endif
|