Increase digits used to convert from REAL/DOUBLEs to strings so that the reverse
 conversions can recover original values. Patch originally by John Smith, slightly changed by me.
Clear errors for prepared statement for subsequent exections.
Fix the problems using SQLFetch on prepared INSERT with RETURNING clause reported by John Smith.
Fix use of server-queried version before connection

psqlODBC attempted to use the version that's queried from the server before it
was obtained from the server during the connection setup. Because the server
version is initialized to 0.0, tests for "server version >= 7.4" or "server
version >= 6.4" using the PG_VERSION_LT macro were always returning false.

Instead, use PROTOCOL_64 and PROTOCOL_74 tests against conninfo. These don't
offer any "greater than" form, so just test both. There's little point adding
anything prettier when it can all be removed when v1/v2 protocol support is
removed soon anyway.

The main symptom of this issue was that psqlODBC was sending an invalid
protocol message for the v3 protocol, "Q \0", causing the server to wait for
the second half of the length word forever. At connection close, the server
would emit:

    unexpected EOF within message length word

This issue was observed while tracking down problems with XA transactions in
MSDTC failing to commit after a successful prepare because an isolated tx
created via getLockedXAConn() got stuck here, but is not confined to that
problem.
Merge remote-tracking branch 'ringerc/fix-febe-protocol-desync-emptyquery'
Don't use PG_VERSION_xx() macros in original_CC_connect() because
it's not obtained from the server yet. This may fix another cause
of the problem Craig Ringer reported.
Fix broken buildX86-installer.ps1 due to the change to use psqlodbcm_cpu.wxs instead of psqlodbcm.wxs.
Fix bug in SQLCancel().

If one thread was busy executing a savepoint statement, while another thread
calls SQLCancel() on the statement, SQLCancel() would try to release the
locks held by the other thread. That's extremely racy; if the other thread
tries to increment/decrement the lock_CC_for_rb counter at the same time,
we could end up releasing the lock to many times or too few times. Also,
releasing a pthread mutex from a different thread than the one who acquired
it is undefined behavior.

AFAICS the DiscardStatementSvp() call in SQLCancel() can be safely removed.
It's outright wrong and dangerous if the statement is busy executing in
a different thread, and the other codepaths in PGAPI_Cancel() already call
DiscardStatementSvp().

Bug report by Jade Koskela.
Refactor SQLCancel() and add comments, for readability.
Fix compilation on Windows, broken by my previous commit.

Michael Paquier
This patch fixes a NULL pointer dereference occurring when connecting
using SSPI authentication (without kerberos, a local Windows user trying
to connect to postgres instance on same host). Patch originally by
Nikhil R Deshpande, 1 line added for safety by me.
Remove unused function.

Previous commit added a void return to a function with char * return value,
which generated a warning. On further inspection, the whole function is
used nowhere, so just remove it rather than try fixing the warning.
Fix bug with UseDeclareFetch=1 when a transaction is committed before fetch.

If a server cursor is closed before the application has fetched any rows
from the result set, the "base" of the result set's cached rowset was
off-by-one.

Also add a regression test for the same.

This fixes the bug reported by Jan-Peter Seifert.