Re: [PORTS] WinCE/Pocket PC port for the C client library

"Magnus Hagander" <[email protected]> Thu, 13 Apr 2006 11:07:45 +0200
Newsgroups gmane.comp.db.postgresql.ports
Message-ID <[email protected]>
> Hello,
> 
> I'm implementing a WinCE 4.x (Pocket PC 2003) application 
> which needs to get data from a postgres database, so I 
> "hacked" the 8.1.2 libpq source so I could get it working.
> 
> Well, it seems to be working ok, but, as I don't know the 
> code, have no idea if my hack is acceptable or induces other 
> bugs I haven't seen yet.

# add_file "src/include/pg_config.h"
# add_file "src/include/pg_config_paths.h"

This part certainly isn't right :-) Those files are supposed to be
auto-generated, not put in the source.


As for:
-				if (getsockopt(conn->sock, SOL_SOCKET,
SO_ERROR,
-							   (char *)
&optval, &optlen) == -1)
+				int err = getsockopt(conn->sock,
SOL_SOCKET, SO_ERROR,
+
(char *) &optval, &optlen);
+#if defined(_WIN32_WCE)
+				/* This was "googled" from the curl
library source */
+				/* Always returns this error, bug in CE?
*/
+				if ( err == -1 && SOCK_ERRNO ==
WSAENOPROTOOPT )
+					err=0;
+#endif
+				if ( err == -1 )


Does it actually *have* the option and fail to set it, or is the option
just not there? If it doesn't exist, you should just #ifdef out the
tryign to set the option, IMHO.


Apart from that it looks OK to me. There definitly needs to be some
documentation on how to build it, though...

//Magnus

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster