1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

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.
This commit is contained in:
Tom Lane
2012-10-07 21:52:07 -04:00
parent ea72bb8ae5
commit 95d035e66d
22 changed files with 130 additions and 66 deletions

View File

@ -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

View File

@ -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
*/

View File

@ -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 */

View File

@ -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;

View File

@ -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