RE: libpq sockets on win32 - Mailing list pgsql-interfaces
From | Jeff Johnson |
---|---|
Subject | RE: libpq sockets on win32 |
Date | |
Msg-id | B9C9130B5D27D4119D5D00A0C9D3A987109461@SERVER Whole thread Raw |
In response to | libpq sockets on win32 ("Jeff Johnson" <jeff@jeffjohnson.net>) |
Responses |
Re: libpq sockets on win32
|
List | pgsql-interfaces |
I found this in WinSock.h ... it might shed some light on the problem. #define WSABASEERR 10000 [snip] /* * Windows Sockets definitions of regular Berkeley error constants */ #define WSAEWOULDBLOCK (WSABASEERR+35) #define WSAEINPROGRESS (WSABASEERR+36) > -----Original Message----- > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] > Sent: Monday, June 04, 2001 4:02 PM > To: jeff@jeffjohnson.net > Cc: pgsql-interfaces@postgresql.org; pgsql-docs@postgresql.org > Subject: Re: [INTERFACES] libpq sockets on win32 > > > > > I have done exactly that. I assume fcntl(), ioctl(), > > > select() use errno > > > even if used on a socket, while getsockopt(), setsockopt(), > > socket(), > > > connect(), getsockname(), send(), recv() use WSAGetLastError. Is > > this > > > list correct? > > > > I don't know enough about such things. > > The web page wasn't clear about that. > > > > > > > The patch is attached. Please let me know so I can > finalize it and > > > apply it. > > > > Couple of changes required to compile on Win32: > > > > Change: > > #define sockerrno WSAGetLastError > > To: > > #define sockerrno WSAGetLastError() > > > > OK. > > > > > This has to go back into fe-connect.c, EINPROGRESS isn't defined in > > Win32 for some reason.. > > #ifndef WIN32 > > if (errno == EINPROGRESS || errno == 0) > > #else > > if (WSAGetLastError() == WSAEINPROGRESS) > > #endif > > > > OK. Not sure why it wasn't defined, but, oh well. > > > > > > > I tested it out but I'm getting this error when sending a large SQL > > statement (>16k). > > cu.execute(sql) > > File "c:\python20\pgdb.py", line 189, in execute > > self.executemany(operation, (params,)) > > File "c:\python20\pgdb.py", line 204, in executemany > > rows = self.__source.execute(sql) > > ValueError: pqReadData() -- read() failed: errno=10035 > > Unknown error > > That errno is very high, 10035. If I take a look at my sys/errno.h on > BSD/OS, I see: > > #define EAGAIN 35 /* Resource temporarily > unavailable */ > > so my guess is that WSAGetLastError() returns errno plus 10,000. What > value does your include file set for EAGAIN, 10035 or 35. If > it is 35, > the following patch may work. It has all your suggested fixes. > > -- > Bruce Momjian | http://candle.pha.pa.us > pgman@candle.pha.pa.us | (610) 853-3000 > + If your life is a hard drive, | 830 Blythe Avenue > + Christ can be your backup. | Drexel Hill, > Pennsylvania 19026 >
pgsql-interfaces by date: