sequence described in the documentation of
.
-typedef pg_int64 pg_usec_time_t;
+typedef int64_t pg_usec_time_t;
int PQsocketPoll(int sock, int forRead, int forWrite,
pg_usec_time_t end_time);
When dealing with large objects that might exceed 2GB in size,
instead use
-pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
+int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence);
This function has the same behavior
as lo_lseek, but it can accept an
When dealing with large objects that might exceed 2GB in size,
instead use
-pg_int64 lo_tell64(PGconn *conn, int fd);
+int64_t lo_tell64(PGconn *conn, int fd);
This function has the same behavior
as lo_tell, but it can deliver a result larger
When dealing with large objects that might exceed 2GB in size,
instead use
-int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
+int lo_truncate64(PGconn *conn, int fd, int64_t len);
This function has the same
behavior as lo_truncate, but it can accept a
#ifndef POSTGRES_EXT_H
#define POSTGRES_EXT_H
-#include
-
/*
* Object ID is a fundamental type in Postgres.
*/
/* the above needs */
-/* Define a signed 64-bit integer type for use in client API declarations. */
-typedef int64_t pg_int64;
-
/*
* Identifiers of error message fields. Kept here to keep common
* between frontend and backend, and also to export them to libpq
static int lo_initialize(PGconn *conn);
static Oid lo_import_internal(PGconn *conn, const char *filename, Oid oid);
-static pg_int64 lo_hton64(pg_int64 host64);
-static pg_int64 lo_ntoh64(pg_int64 net64);
+static int64_t lo_hton64(int64_t host64);
+static int64_t lo_ntoh64(int64_t net64);
/*
* lo_open
* returns -1 upon failure
*/
int
-lo_truncate64(PGconn *conn, int fd, pg_int64 len)
+lo_truncate64(PGconn *conn, int fd, int64_t len)
{
PQArgBlock argv[2];
PGresult *res;
* lo_lseek64
* change the current read or write location on a large object
*/
-pg_int64
-lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence)
+int64_t
+lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence)
{
PQArgBlock argv[3];
PGresult *res;
- pg_int64 retval;
+ int64 retval;
int result_len;
if (lo_initialize(conn) < 0)
* lo_tell64
* returns the current seek location of the large object
*/
-pg_int64
+int64_t
lo_tell64(PGconn *conn, int fd)
{
- pg_int64 retval;
+ int64 retval;
PQArgBlock argv[1];
PGresult *res;
int result_len;
* lo_hton64
* converts a 64-bit integer from host byte order to network byte order
*/
-static pg_int64
-lo_hton64(pg_int64 host64)
+static int64_t
+lo_hton64(int64_t host64)
{
union
{
- pg_int64 i64;
+ int64 i64;
uint32 i32[2];
} swap;
uint32 t;
* lo_ntoh64
* converts a 64-bit integer from network byte order to host byte order
*/
-static pg_int64
-lo_ntoh64(pg_int64 net64)
+static int64_t
+lo_ntoh64(int64_t net64)
{
union
{
- pg_int64 i64;
+ int64 i64;
uint32 i32[2];
} swap;
- pg_int64 result;
+ int64 result;
swap.i64 = net64;
{
#endif
+#include
#include
/*
struct pgNotify *next; /* list link */
} PGnotify;
+/* deprecated name for int64_t */
+typedef int64_t pg_int64;
+
/* pg_usec_time_t is like time_t, but with microsecond resolution */
-typedef pg_int64 pg_usec_time_t;
+typedef int64_t pg_usec_time_t;
/* Function types for notice-handling callbacks */
typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
-extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
+extern int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence);
extern Oid lo_creat(PGconn *conn, int mode);
extern Oid lo_create(PGconn *conn, Oid lobjId);
extern int lo_tell(PGconn *conn, int fd);
-extern pg_int64 lo_tell64(PGconn *conn, int fd);
+extern int64_t lo_tell64(PGconn *conn, int fd);
extern int lo_truncate(PGconn *conn, int fd, size_t len);
-extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
+extern int lo_truncate64(PGconn *conn, int fd, int64_t len);
extern int lo_unlink(PGconn *conn, Oid lobjId);
extern Oid lo_import(PGconn *conn, const char *filename);
extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
*
*-------------------------------------------------------------------------
*/
+#include
#include
#include
}
static void
-pickout(PGconn *conn, Oid lobjId, pg_int64 start, int len)
+pickout(PGconn *conn, Oid lobjId, int64_t start, int len)
{
int lobj_fd;
char *buf;
}
static void
-overwrite(PGconn *conn, Oid lobjId, pg_int64 start, int len)
+overwrite(PGconn *conn, Oid lobjId, int64_t start, int len)
{
int lobj_fd;
char *buf;
}
static void
-my_truncate(PGconn *conn, Oid lobjId, pg_int64 len)
+my_truncate(PGconn *conn, Oid lobjId, int64_t len)
{
int lobj_fd;