Re: [INTERFACES] libpq sockets on win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: jeff(at)jeffjohnson(dot)net
Cc: pgsql-interfaces(at)postgresql(dot)org, pgsql-docs(at)postgresql(dot)org
Subject: Re: [INTERFACES] libpq sockets on win32
Date: 2001-06-04 20:02:00
Message-ID: 200106042002.f54K20L06218@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-interfaces

> > 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 10.1 KB

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Jeff Johnson 2001-06-04 20:25:05 RE: [INTERFACES] libpq sockets on win32
Previous Message Jeff Johnson 2001-06-04 19:48:50 RE: [INTERFACES] libpq sockets on win32

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jeff Johnson 2001-06-04 20:25:05 RE: [INTERFACES] libpq sockets on win32
Previous Message Jeff Johnson 2001-06-04 19:48:50 RE: [INTERFACES] libpq sockets on win32