I built PostgreSQL ODBC driver in VS2008 , then run odbcad32.exe, create DSN and click on Test button. It works fine.
Then I copied folder and rebuilt it in VS2010, then did the same actions: I receive error message COuld not send query(Connection dead).
Then i made: compiled in VS2005 – all works.
In Vs2012 – does not work.
I checked in Debugger: yes, it is, socket was closed during the short query execution, button Test generates something like this sequence of queries:
set DateStyle to 'ISO'
....
set extra_float_digits to 2
...
[5912-1.471]CC_send_query: conn=04460048, query='select oid, typbasetype from pg_type where typname = 'lo''
[5912-1.472]send_query: done sending query 63bytes flushed
[5912-1.473]in QR_Constructor
[5912-1.473]exit QR_Constructor
[5912-1.473]read -1, global_socket_buffersize=4096
[5912-1.474]Lasterror=10035
[5912-1.474](5)Error while reading from the socket. ERRNO=10035
[5912-1.475]CC_error_statements: self=04460048
[5912-1.475]CONN ERROR: func=CC_send_query, desc='', errnum=107, errmsg='No response from the backend'
...
[5912-1.481]CC_lookup_characterset: entering...
[5912-1.481]CC_send_query: conn=04460048, query='select pg_client_encoding()'
[5912-1.482]CC_error_statements: self=04460048
[5912-1.482]CONN ERROR: func=CC_send_query, desc='', errnum=104, errmsg='Could not send Query(connection dead)'
What may be a reason of this different behaviour?
The “problem” is that since VS2010 EWOULDBLOCK (defined in errno.h) != WSAEWOULDBLOCK, while developers relied on these two values to be the same, similar to:
What used to work with older version of VS, does not work anymore.