Fix potentially uninitialized local pointer access which causes
fatal compilation errors on vs2012/2013 reported by Craig Ringer.
It's safe to add this change in addition to the previous commit.
d0c993d3f6f0a4496a20486f2ec19b14591baba7
Author: U-Lenovo-PC\hiroshi <hiroshi@Lenovo-PC.(none)>
Date:   Sat Jun 14 21:53:57 2014 +0900

    Fix potentially uninitialized local pointer access which causes
    fatal compilation errors on vs2012/2013 reported by Craig Ringer.
Fix the warning MSB8028: The intermediate directory (..\x86_Unicode_Release\) contains files shared from another project (pgxalib.vcxproj).  This can lead to incorrect clean and rebuild behavior.
Document build outputs

The build didn't explain what went where, or what to do about dependencies.
Improve the docs to cover the topic.
Discuss issues with SDK support and installation
ctype_length() is missing the length for SQL_C_BIGINT and SQL_C_NUMERIC(patch by John Smith <nukemd@hotmail.com>).
Fix access to unallocated memory in IAsyncPG

IAsyncPG was deleting its self, then returning an instance variable
by value. This is probably going to be safe pretty much all the time,
but it's still a memory error, and DrMemory (a Windows valgrind-alike)
complains about it:

	Error #4: UNADDRESSABLE ACCESS: reading 0x00b1b2b0-0x00b1b2b4 4 byte(s)
	# 0 pgenlista.dll!IAsyncPG::Release   [c:\users\administrator\desktop\psqlodbc\msdtc_enlist.cpp:352]
	# 1 pgenlista.dll!CloseCommitThread   [c:\users\administrator\desktop\psqlodbc\msdtc_enlist.cpp:971]
	# 2 MSVCR120D.dll!_callthreadstart    [f:\dd\vctools\crt\crtw32\startup\thread.c:255]
	# 3 MSVCR120D.dll!_threadstart        [f:\dd\vctools\crt\crtw32\startup\thread.c:237]
	# 4 KERNEL32.dll!BaseThreadInitThunk +0x11     (0x7768338a <KERNEL32.dll+0x1338a>)
	Note: @0:00:57.879 in thread 4516
	Note: next higher malloc: 0x00b1b420-0x00b1b440
	Note: 0x00b1b2b0-0x00b1b2b4 overlaps memory 0x00b1b2a0-0x00b1b390 that was freed here:
	Note: # 0 replace_operator_delete                              [d:\drmemory_package\common\alloc_replace.c:2524]
	Note: # 1 pgenlista.dll!IAsyncPG::`scalar deleting destructor'
	Note: # 2 pgenlista.dll!IAsyncPG::Release                      [c:\users\administrator\desktop\psqlodbc\msdtc_enlist.cpp:341]
	Note: # 3 pgenlista.dll!CloseCommitThread                      [c:\users\administrator\desktop\psqlodbc\msdtc_enlist.cpp:971]
	Note: # 4 MSVCR120D.dll!_callthreadstart                       [f:\dd\vctools\crt\crtw32\startup\thread.c:255]
	Note: # 5 MSVCR120D.dll!_threadstart                           [f:\dd\vctools\crt\crtw32\startup\thread.c:237]
	Note: # 6 KERNEL32.dll!BaseThreadInitThunk                    +0x11     (0x7768338a <KERNEL32.dll+0x1338a>)
	Note: instruction: mov    0x10(%eax) -> %eax

This patch fixes the issue.
SQL_NUMERIC_STRUCT was not available until ODBC 3.0

Also add a prototype for ResolveNumericParam for readability.
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.