Protect shared connection list when making cleanup tasks in EN_Destructor
using the patch provided by Michael Kocherov.
Fixed EN_Destructor provided. Per Michael Kocherov.
patch by Inoue-san.
memset arguments were reversed.

Found by Coverity scan.
fix typo in comment.
Allocate right amount of space in malloc().

This happened to be just harmless waste of memory, because
sizeof(ParameterInfoClass) > sizeof(ParameterImplClass), but it was clearly
wrong.

Found by Coverity scan.
Fix reference-after-free bug.

'refcnt' is a member variable, so it mustn't be referenced after
"delete this;"

Found by Coverity scan.
If one of 'Database', 'Port', or 'Servername' is missing, make error message
more specific.
Check SIZEOF_LONG_INT when deciding whether SQLROWSETSIZE exists.

For some reason SIZEOF_VOID_P is 0 on my system. But unixodbc's sqltypes.h
header file uses SIZEOF_LONG_INT to decide whether SQLROWSETSIZE exists or
not, so we should use the same.
Check BUILD_LEGACY_64_BIT_MODE instead of BUILD_REAL_64_BIT_MODE.

Since unixODBC version 2.2.13, the #define that controls whether SQLLEN
and SQLULEN are 32-bits or 64-bits wide is called BUILD_LEGACY_64_BIT_MODE,
not BUILD_REAL_64_BIT_MODE (the default changed to 64-bits in 2.2.13).
2.2.13 was released in 2006, so it's probably safe to assume that psqlodbc
is being built against that or higher.
Remove commented-out if-check, and related unused variable.

This silences a compiler warning about the unused variable.
Use -Wno-pointer-sign to silence a lot of warnings.

We liberally assign between SQLCHAR * and char *, which generates a lot of
compiler warnings about different pointer signedness. Seems like a lost
cause to add casts everywhere (and it might not be good for robustness
anyway, because it might mask a bug where the datatype of one side is
changed to a struct or something in the future), so just silence the
warnings.
Silence compiler warnings about variables set but not used.
Silence compiler warning about unhandled enum values in switch.
Fix typo in format string, which fixes passing an interval as param.

Compiler warned about this.
Use FORMAT_ULEN to print SQLULENs.

Silences a compiler warning.
Silence compiler warning by casting away a const.
Call shared library destructor at dlclose() or end of program.

For some reason, the destructor was not being called when compiled with gcc.
Not sure why, but I'm assuming it was an oversight. This silences a compiler
warning complaining that finalize_global_cs() function was unused.
Silence warning about losing const in "const char *" to "char *" assignment.
Add parens, per compiler warning's suggestion.
Silence compiler warnings about unused msg_truncated variables.

BTW, the error and notice handling could be made much smarter wrt.
truncation. The caller of handle_notice/error_message knows the message size
in advance, so it could easily pass it down and we could allocate a buffer
of the right size, instead of using a fixed size buffer that can be too
small.