diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-10-07 21:52:07 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-10-07 21:52:43 -0400 |
commit | 95d035e66d8e4371d35830d81f39face03cd4c45 (patch) | |
tree | 450c4e30491bd17f6499e8a33c094f9353238f79 /src/interfaces | |
parent | ea72bb8ae527d371ccaf53647540a33224df92a6 (diff) | |
download | postgresql-95d035e66d8e4371d35830d81f39face03cd4c45.tar.gz postgresql-95d035e66d8e4371d35830d81f39face03cd4c45.zip |
Autoconfiscate selection of 64-bit int type for 64-bit large object API.
Get rid of the fundamentally indefensible assumption that "long long int"
exists and is exactly 64 bits wide on every platform Postgres runs on.
Instead let the configure script select the type to use for "pg_int64".
This is a bit of a pain in the rear since we do not want to pollute client
namespace with all the random symbols that pg_config.h defines; instead
we have to create a separate generated header file, "pg_config_ext.h".
But now that the infrastructure is there, we might have the ability to
add some other stuff that's long been wanting in this area.
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/libpq/bcc32.mak | 5 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-lobj.c | 15 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 18 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 6 | ||||
-rw-r--r-- | src/interfaces/libpq/win32.mak | 5 |
5 files changed, 18 insertions, 31 deletions
diff --git a/src/interfaces/libpq/bcc32.mak b/src/interfaces/libpq/bcc32.mak index fbef737ecda..441fb5e76fb 100644 --- a/src/interfaces/libpq/bcc32.mak +++ b/src/interfaces/libpq/bcc32.mak @@ -153,11 +153,14 @@ LIB32_OBJS= \ "$(INTDIR)\pthread-win32.obj" -config: ..\..\include\pg_config.h ..\..\include\pg_config_os.h pg_config_paths.h +config: ..\..\include\pg_config.h ..\..\include\pg_config_ext.h ..\..\include\pg_config_os.h pg_config_paths.h ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32 copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h +..\..\include\pg_config_ext.h: ..\..\include\pg_config_ext.h.win32 + copy ..\..\include\pg_config_ext.h.win32 ..\..\include\pg_config_ext.h + ..\..\include\pg_config_os.h: ..\..\include\port\win32.h copy ..\..\include\port\win32.h ..\..\include\pg_config_os.h diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 022cfec0932..7c40100b86b 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -187,7 +187,6 @@ lo_truncate(PGconn *conn, int fd, size_t len) * returns 0 upon success * returns -1 upon failure */ -#ifdef HAVE_PG_INT64 int lo_truncate64(PGconn *conn, int fd, pg_int64 len) { @@ -232,7 +231,6 @@ lo_truncate64(PGconn *conn, int fd, pg_int64 len) return -1; } } -#endif /* * lo_read @@ -325,10 +323,7 @@ lo_write(PGconn *conn, int fd, const char *buf, size_t len) /* * lo_lseek * change the current read or write location on a large object - * currently, only L_SET is a legal value for whence - * */ - int lo_lseek(PGconn *conn, int fd, int offset, int whence) { @@ -372,11 +367,7 @@ lo_lseek(PGconn *conn, int fd, int offset, int whence) /* * lo_lseek64 * change the current read or write location on a large object - * currently, only L_SET is a legal value for whence - * */ - -#ifdef HAVE_PG_INT64 pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence) { @@ -424,7 +415,6 @@ lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence) return -1; } } -#endif /* * lo_creat @@ -554,9 +544,7 @@ lo_tell(PGconn *conn, int fd) /* * lo_tell64 * returns the current seek location of the large object - * */ -#ifdef HAVE_PG_INT64 pg_int64 lo_tell64(PGconn *conn, int fd) { @@ -595,12 +583,10 @@ lo_tell64(PGconn *conn, int fd) return -1; } } -#endif /* * lo_unlink * delete a file - * */ int @@ -1031,6 +1017,7 @@ lo_initialize(PGconn *conn) return -1; } } + /* * Put the structure into the connection control */ diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 73568ca23c3..0b8d9a6813c 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -507,24 +507,21 @@ extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_lengt /* === in fe-print.c === */ -extern void -PQprint(FILE *fout, /* output stream */ +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, +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, +extern void PQprintTuples(const PGresult *res, FILE *fout, /* output stream */ int printAttName, /* print attribute names */ int terseOutput, /* delimiter bars */ @@ -539,21 +536,18 @@ 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, 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 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 int lo_truncate(PGconn *conn, int fd, size_t len); +extern int lo_truncate64(PGconn *conn, int fd, pg_int64 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); extern int lo_export(PGconn *conn, Oid lobjId, const char *filename); -#ifdef HAVE_PG_INT64 -extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence); -extern pg_int64 lo_tell64(PGconn *conn, int fd); -extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len); -#endif - /* === in fe-misc.c === */ /* Get the version of the libpq library in use */ diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 375821e017f..f420476ad21 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -271,11 +271,11 @@ typedef struct pgLobjfuncs Oid fn_lo_create; /* OID of backend function lo_create */ Oid fn_lo_unlink; /* OID of backend function lo_unlink */ Oid fn_lo_lseek; /* OID of backend function lo_lseek */ - Oid fn_lo_lseek64; /* OID of backend function lo_lseek64 */ + Oid fn_lo_lseek64; /* OID of backend function lo_lseek64 */ Oid fn_lo_tell; /* OID of backend function lo_tell */ - Oid fn_lo_tell64; /* OID of backend function lo_tell64 */ + Oid fn_lo_tell64; /* OID of backend function lo_tell64 */ Oid fn_lo_truncate; /* OID of backend function lo_truncate */ - Oid fn_lo_truncate64; /* OID of backend function lo_truncate64 */ + Oid fn_lo_truncate64; /* OID of function lo_truncate64 */ Oid fn_lo_read; /* OID of backend function LOread */ Oid fn_lo_write; /* OID of backend function LOwrite */ } PGlobjfuncs; diff --git a/src/interfaces/libpq/win32.mak b/src/interfaces/libpq/win32.mak index 70a741a5f41..9355de23cef 100644 --- a/src/interfaces/libpq/win32.mak +++ b/src/interfaces/libpq/win32.mak @@ -164,11 +164,14 @@ LIB32_OBJS= \ "$(INTDIR)\pthread-win32.obj" -config: ..\..\include\pg_config.h pg_config_paths.h ..\..\include\pg_config_os.h +config: ..\..\include\pg_config.h ..\..\include\pg_config_ext.h pg_config_paths.h ..\..\include\pg_config_os.h ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32 copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h +..\..\include\pg_config_ext.h: ..\..\include\pg_config_ext.h.win32 + copy ..\..\include\pg_config_ext.h.win32 ..\..\include\pg_config_ext.h + ..\..\include\pg_config_os.h: copy ..\..\include\port\win32.h ..\..\include\pg_config_os.h |