summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2000-01-18 19:05:31 +0000
committerBruce Momjian <bruce@momjian.us>2000-01-18 19:05:31 +0000
commit0cb6bc70cec12d4fbcb68673bd73453061de89f2 (patch)
treeb34d4c0d427b5b24eeb195935957787f843fe59d /src/interfaces/libpq
parent2eebcddeaa2a60fe836a8a10ac6c697bdd36bf8e (diff)
downloadpostgresql-0cb6bc70cec12d4fbcb68673bd73453061de89f2.tar.gz
Hi!
Here is a patch to bring both libpq and psql to a state where it compiles on win32 (native) again. A lot of things have changed, and I have not been able to keep up with them all, so it has been broken for quite a while. After this patch, at least it compiles. It also talks "basic talk" to the server, but I have not yet tested all things. Sending queries, and using e.g. \d or \dt works fine. The rest will have to be tested further. It also bumps the version on libpq.dll to 7.0. Everything should be enclosed in #ifdef WIN32, unless I have missed something. Except for one or maybe two places where I have moved a #include that should not be used on win32 from the "global area" into a "#ifndef WIN32 area". //Magnus
Diffstat (limited to 'src/interfaces/libpq')
-rw-r--r--src/interfaces/libpq/fe-auth.c4
-rw-r--r--src/interfaces/libpq/fe-connect.c24
-rw-r--r--src/interfaces/libpq/fe-misc.c4
-rw-r--r--src/interfaces/libpq/fe-print.c4
-rw-r--r--src/interfaces/libpq/libpq.rc10
-rw-r--r--src/interfaces/libpq/libpqdll.def11
-rw-r--r--src/interfaces/libpq/pqexpbuffer.c8
7 files changed, 52 insertions, 13 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index fe92bd6964..53d29a59d3 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -9,7 +9,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.34 1999/10/25 03:08:00 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.35 2000/01/18 19:05:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,9 @@
*
*/
+#ifndef WIN32
#include "postgres.h"
+#endif
#include "libpq-fe.h"
#include "libpq-int.h"
#include "fe-auth.h"
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 818b85f0ea..a444e5bd7a 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -7,13 +7,12 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.112 2000/01/18 06:09:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.113 2000/01/18 19:05:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <sys/types.h>
-#include <sys/socket.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
@@ -26,6 +25,7 @@
#ifdef WIN32
#include "win32.h"
#else
+#include <sys/socket.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/tcp.h>
@@ -43,6 +43,16 @@
#include "mb/pg_wchar.h"
#endif
+#ifdef WIN32
+static int inet_aton(const char *cp, struct in_addr *inp) {
+ unsigned long a = inet_addr(cp);
+ if (a == -1)
+ return 0;
+ inp->s_addr = a;
+ return 1;
+}
+#endif
+
/* ----------
* pg_setenv_state
* A struct used when polling a setenv request. This is referred to externally
@@ -842,7 +852,11 @@ connectDBStart(PGconn *conn)
*/
if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len) < 0)
{
+#ifndef WIN32
if (errno == EINPROGRESS)
+#else
+ if (WSAGetLastError() == WSAEINPROGRESS)
+#endif
{
/* This is fine - we're in non-blocking mode, and the
* connection is in progress. */
@@ -1036,8 +1050,12 @@ PQconnectPoll(PGconn *conn)
case CONNECTION_STARTED:
{
SOCKET_SIZE_TYPE laddrlen;
+#ifndef WIN32
int optval;
- int optlen = sizeof(int);
+#else
+ char optval;
+#endif
+ int optlen = sizeof(optval);
/* Write ready, since we've made it here, so the connection
* has been made. */
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index a936e93742..b87ab4df98 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -24,12 +24,11 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.34 2000/01/18 06:09:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.35 2000/01/18 19:05:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-#include <sys/time.h>
#include <errno.h>
#include <signal.h>
#include <time.h>
@@ -43,6 +42,7 @@
#include "win32.h"
#else
#include <unistd.h>
+#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index d6f952d32b..7a73a8669b 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -9,7 +9,7 @@
* didn't really belong there.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.29 2000/01/15 05:37:21 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.30 2000/01/18 19:05:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,8 +30,10 @@
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#else
+#ifndef WIN32
#include <sys/termios.h>
#endif
+#endif
#ifdef MULTIBYTE
#include "mb/pg_wchar.h"
diff --git a/src/interfaces/libpq/libpq.rc b/src/interfaces/libpq/libpq.rc
index 9bf68cb19a..5a6ada372a 100644
--- a/src/interfaces/libpq/libpq.rc
+++ b/src/interfaces/libpq/libpq.rc
@@ -1,8 +1,8 @@
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,6,0,0
- PRODUCTVERSION 6,6,0,0
+ FILEVERSION 7,0,0,0
+ PRODUCTVERSION 7,0,0,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS__WINDOWS32
@@ -15,13 +15,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "PostgreSQL Access Library\0"
- VALUE "FileVersion", "6, 6, 0, 0\0"
+ VALUE "FileVersion", "7, 0, 0, 0\0"
VALUE "InternalName", "libpq\0"
- VALUE "LegalCopyright", "Copyright (C) 1999\0"
+ VALUE "LegalCopyright", "Copyright (C) 2000\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libpq.dll\0"
VALUE "ProductName", "PostgreSQL\0"
- VALUE "ProductVersion", "6, 6, 0, 0\0"
+ VALUE "ProductVersion", "7, 0, 0, 0\0"
END
END
BLOCK "VarFileInfo"
diff --git a/src/interfaces/libpq/libpqdll.def b/src/interfaces/libpq/libpqdll.def
index d83bdfafd4..dc33dc0ee9 100644
--- a/src/interfaces/libpq/libpqdll.def
+++ b/src/interfaces/libpq/libpqdll.def
@@ -67,3 +67,14 @@ EXPORTS
PQmblen @ 64
PQresultErrorMessage @ 65
PQresStatus @ 66
+ termPQExpBuffer @ 67
+ appendPQExpBufferChar @ 68
+ initPQExpBuffer @ 69
+ resetPQExpBuffer @ 70
+ PQoidValue @ 71
+ PQclientencoding @ 72
+ PQenv2encoding @ 73
+ appendBinaryPQExpBuffer @ 74
+ appendPQExpBufferStr @ 75
+ destroyPQExpBuffer @ 76
+ createPQExpBuffer @ 77
diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c
index bedf456b3c..6850a80c5b 100644
--- a/src/interfaces/libpq/pqexpbuffer.c
+++ b/src/interfaces/libpq/pqexpbuffer.c
@@ -16,7 +16,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.2 2000/01/17 02:59:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.3 2000/01/18 19:05:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,6 +24,12 @@
#include "postgres.h"
#include "pqexpbuffer.h"
+#ifdef WIN32
+#include <stdarg.h>
+#include <stdio.h>
+#include "win32.h"
+#endif
+
/*
* createPQExpBuffer
*