diff options
author | Bruce Momjian <bruce@momjian.us> | 2003-07-27 03:32:26 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2003-07-27 03:32:26 +0000 |
commit | 9df48371c20869ac63a63b45550dbf4b045aa4bf (patch) | |
tree | d01352587f18c4d1ba7827295a5a9aa06ffe5feb /src/interfaces/libpq/fe-connect.c | |
parent | e7fe89d57ddda6ad35c68bfcf1d78c2fe0caac4e (diff) |
here are the patches for psql on Win32:
psql4win32.patch - changes in the psql source code
psql-ref.patch - changes in the documentation psql-ref.sgml
(for new builtin variable WIN32_CONSOLE)
To apply them use "patch -p 1" in the root directory of the
postgres source directory.
These patches fix the following problems of psql on Win32
(all changes only have effect #ifdef WIN32):
a) Problem: Static library libpq.a did not work
Solution: Added WSAStartup() in fe-connect.c
b) Problem: Secret Password was echoed by psql
Solution: Password echoing disabled in sprompt.c
c) Problem: 8bit characters were displayed/interpreted wrong in psql
This is due to the fact that the Win32 "console" uses a
different encoding than the rest of the Windows system
Solution: Introduced a new psql variable WIN32_CONSOLE
When set with "\set WIN32_console", the function OemToChar()
is applied after reading input and CharToOem() before
displaying Output
Christoph Dalitz
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 6688e570381..af526a8f041 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.254 2003/07/26 13:50:02 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.255 2003/07/27 03:32:26 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1970,9 +1970,25 @@ makeEmptyPGconn(void) { PGconn *conn = (PGconn *) malloc(sizeof(PGconn)); +/* needed to use the static libpq under windows as well */ +#ifdef WIN32 + WSADATA wsaData; +#endif + if (conn == NULL) return conn; +#ifdef WIN32 + if (WSAStartup(MAKEWORD(1, 1), &wsaData)) + { + free(conn); + return (PGconn*) NULL; + } + + WSASetLastError(0); + +#endif + /* Zero all pointers and booleans */ MemSet((char *) conn, 0, sizeof(PGconn)); |