Hiroshi Inoue [Mon, 13 Oct 2014 04:52:52 +0000 (13:52 +0900)]
Enable -Wall compile option if it's available.
Hiroshi Inoue [Sat, 11 Oct 2014 10:29:40 +0000 (19:29 +0900)]
PG_BUILD_VERSION seems no longer needed.
Hiroshi Inoue [Sat, 11 Oct 2014 07:18:04 +0000 (16:18 +0900)]
Include pdb files in the contents of installers.
Hiroshi Inoue [Sat, 11 Oct 2014 07:45:32 +0000 (16:45 +0900)]
Removed RESET_CRYPTO_CALLBACKS preprocessor symbol definition.
This is no longer needed and rather dangerous.
The removal also make it possible to remove the dependency to libeay32.
Hiroshi Inoue [Thu, 9 Oct 2014 23:53:03 +0000 (08:53 +0900)]
Removed a duplicated description.
Hiroshi Inoue [Thu, 9 Oct 2014 06:45:47 +0000 (15:45 +0900)]
Suppress option button from the bootstrapper dialog using BalExtention.
Hiroshi Inoue [Wed, 8 Oct 2014 23:10:32 +0000 (08:10 +0900)]
Don't continue to build installers in case the compilation failed.
Hiroshi Inoue [Wed, 8 Oct 2014 21:26:33 +0000 (06:26 +0900)]
Use 1ST, 2ND or 3RD PAGE instead of PREV or NEXT PAGE for the setup
program.
Hiroshi Inoue [Tue, 24 Jun 2014 01:02:53 +0000 (10:02 +0900)]
Add a powershell script buildBootStrapper.ps1 which builds bootStrapper program
with some optional parameters. Quote the version number of bootstrapper from
the configuration xml file unless specified. Also change the name of 32bit MSI
in the bootstrapper according to changes of 32bit installer build system.
Change buildInstallers.ps1 build the bootstrapper together.
Change ALLUSERS from "2" to "1" of the 64bit installer.
Hiroshi Inoue [Wed, 8 Oct 2014 08:17:53 +0000 (17:17 +0900)]
Fix the wrong use of snprintf format in the previous commit.
Hiroshi Inoue [Wed, 8 Oct 2014 07:44:50 +0000 (16:44 +0900)]
Avoid the registry operation to set XADLL entry from wow64 process.
Hiroshi Inoue [Thu, 3 Jul 2014 03:47:41 +0000 (12:47 +0900)]
Cleanup the code for *test* button and add the functionality to test
MSDTC support.
Hiroshi Inoue [Wed, 1 Oct 2014 04:01:54 +0000 (13:01 +0900)]
Add a new dialog page to the setup program and allow the setting
of PREFERLIBPQ and XAOPT option.
Heikki Linnakangas [Tue, 7 Oct 2014 07:45:30 +0000 (10:45 +0300)]
Silence compilers warnings without _HANDLE_ENLIST_IN_DTC_ or USE_LIBPQ.
Compiler complained about unused variable.
Heikki Linnakangas [Tue, 7 Oct 2014 07:36:14 +0000 (10:36 +0300)]
Fix SQLTables column names to be ODBC version 3 compliant
In ODBC3, TABLE_QUALIFIER was renamed to TABLE_CAT, and TABLE_OWNER to
TABLE_SCHEM.
David Hedberg
Heikki Linnakangas [Tue, 7 Oct 2014 07:14:38 +0000 (10:14 +0300)]
Improve regression test for reading a bytea column to SQL_C_CHAR.
When converting a bytea to SQL_C_CHAR, the driver uses upper-case letters in
the hex output, while the backend uses lower-case letters. That leads to
different output when using bytea_output=hex than with bytea_output=escape.
Set bytea_output explicitly in the regression test, so that it works
regardless of the current bytea_output setting. And test both settings - the
code path taken in the driver is quite different.
Hiroshi Inoue [Mon, 6 Oct 2014 14:16:39 +0000 (23:16 +0900)]
Add the libpq use parameter to the dtc connection string.
Hiroshi Inoue [Wed, 24 Sep 2014 13:22:29 +0000 (22:22 +0900)]
Additonal improvement on MSDTC enlistment.
Unfortunately the current pgxalib.dll can't recover transactions which use
sslmode verify-[ca|full] or whose authentication is SSPI, certificate or
ident.
When MSDTC.exe tries to connect to PostgreSQL it does so under Windows user
NETWORKSERVICE, which won't match the username the original user connected
to PostgreSQL as. So PostgreSQL will reject the connection.
In addition XARMcreate() doesn't detect it on enlistment because invoked
xa_open() doesn't connect to the specified datasource. Though it has no
problem unless crash occurs between PREAPARE and COMMIT, the recovery of
the transaction is impossible when such a crash occurs.
Now 3 diffrent behaviors can be speicified using the xaopt connection
string option.
1: The current default behavior.
2: Same as above except it simply examines if the recovery for the specified
datasource is unavailable before calling XARMcreate(). Currently it only
examines whether the connection uses sslmode verify-[ca|full]. I can't find
the way to detect SSPI, certicate or ident authentication.
3: Invoked xa_open() tries to connect to the specified datasource immediately
as user Network Service.
Hiroshi Inoue [Fri, 26 Sep 2014 02:38:18 +0000 (11:38 +0900)]
Register the XA DLL on installation.
MSDTC runs in 64bit mode on 64bit machines and 32bit mode on 32bit machines.
We had better register the XA DLL on installation.
Hiroshi Inoue [Fri, 26 Sep 2014 01:06:29 +0000 (10:06 +0900)]
Fix the regkey search bug when XARMcreate() causes an error at enlistment
in DTC.
Hiroshi Inoue [Thu, 25 Sep 2014 00:11:55 +0000 (09:11 +0900)]
Add '#ifdef USE_LIBPQ' around the code which use PreferLibpq option
introduced in the previous commit.
Hiroshi Inoue [Tue, 16 Sep 2014 07:51:38 +0000 (16:51 +0900)]
Add an option to explicitly force/avoid the use of libpq library.
Hiroshi Inoue [Tue, 24 Jun 2014 00:58:46 +0000 (09:58 +0900)]
Improve pgxalib.dll(MSDTC support).
1. Add an option which lets xa_open() try to connect to the database
immediately. This would cause an error at enlistment in dtc when
the authentication method depends not only on the db user but also
on the OS user, which means the automatic transaction recovery is
unavailable.
2. Log the error message in case of SQLDriverConnect() error.
3. Improve the logging.
Hiroshi Inoue [Sun, 21 Sep 2014 04:59:09 +0000 (13:59 +0900)]
Fix the bug reported by Phillippe Champignon.
The function SC_setInsertedTable() prepares an info for subsequent
'select @@IDENTITY' command. Take table name like catalog.schema.table
into account in the function.
Hiroshi Inoue [Wed, 17 Sep 2014 03:34:10 +0000 (12:34 +0900)]
Add msvc runtime dlls which are needed by the drivers to the installers.
Hiroshi Inoue [Fri, 19 Sep 2014 04:25:55 +0000 (13:25 +0900)]
Add a switch type parameter to BuildAll Powershell script which makes
it possible to build the installers after building drivers.
Hiroshi Inoue [Sun, 14 Sep 2014 00:26:16 +0000 (09:26 +0900)]
Fix a crash bug.
Heikki Linnakangas [Fri, 5 Sep 2014 14:55:22 +0000 (17:55 +0300)]
Fix buffer overflow in SQLGetData.
If a PostgreSQL timestamp column is fetched using SQLGetData, into a
SQL_C_CHAR output variable, with size of 20-22 bytes, the driver might
overrun the buffer by a few bytes with unusual timestamp values, with
year < 0 or > 10000.
While at it, fix the truncation behavior for date/time/timestamp values
so that if the output buffer is too small, we still write what fits and
truncate, instead of writing nothing. This is something that one might
do on purpose, e.g. if you only want to fetch the year part of a date,
you might call SQLGetData() on a date column, with only 4 bytes long
output buffer. (although we haven't heard any complaints from the field).
Also, if the output buffer is of type SQL_C_WCHAR, but the buffer length
is odd, and we have to truncate, we didn't NULL-terminate the string.
Using an odd-sized buffer with SQL_C_WCHAR is a pretty unlikely thing to
do, but nevertheless I think this is more correct behavior.
Add test cases for the bugs fixed.
Heikki Linnakangas [Fri, 5 Sep 2014 14:39:09 +0000 (17:39 +0300)]
Add a test case for data type conversions for results coming from server
Heikki Linnakangas [Fri, 5 Sep 2014 14:23:16 +0000 (17:23 +0300)]
Minor cleanup.
Heikki Linnakangas [Fri, 5 Sep 2014 12:47:31 +0000 (15:47 +0300)]
Remove unused or bogus PG_TYPE macros.
Some of these allegedly built-in types didn't exist in PostgreSQL source code
(maybe they did in some ancient version?), some were just unused in
psqlodbc code.
Heikki Linnakangas [Thu, 4 Sep 2014 07:55:40 +0000 (10:55 +0300)]
Remove unused function.
Silences a compiler warning.
Heikki Linnakangas [Thu, 4 Sep 2014 07:50:28 +0000 (10:50 +0300)]
Fix bug in building an abbreviated connection string.
Introduced by the keepalive-patch, which accidentally removed a line from
sprintf format string. Caught by a compiler warning.
Heikki Linnakangas [Thu, 4 Sep 2014 07:37:56 +0000 (10:37 +0300)]
Silence compiler warnings about unused variables.
Heikki Linnakangas [Thu, 4 Sep 2014 07:27:55 +0000 (10:27 +0300)]
Fix race condition in getting the current decimal separator.
The code to get the current decimal separator was not thread-safe. If two
threads concurrently saw that the locale had changed, they might both try
to free() the same string.
This isn't a perfect fix, there's still a race condition if a thread changes
the locale while another thread is running the psqlodbc code. But at least
this eliminates the race condition when the locale was changed earlier, not
concurrently, and even if it is changed concurrently, this is less likely
to crash, depending on the way localeconv() is implemented in libc.
Hiroshi Inoue [Fri, 20 Jun 2014 12:23:31 +0000 (18:08 +0545)]
Clear unused stuff from PgDtc_isolate() function. Also add CC_initialize_pg_version() call after CC_copy_conninfo() so as to avoid the trouble caused by early PG_VERSION_xx() calls.
Hiroshi Inoue [Tue, 12 Aug 2014 04:28:16 +0000 (13:28 +0900)]
Get rid of copy and paste code in installer/ and unify them.
The powershell scripts had lots of duplication. Make the unified
code instead.
Original patch was provided by Craig Ringer.
Hiroshi Inoue [Thu, 10 Jul 2014 03:51:50 +0000 (12:51 +0900)]
Add a check for NULL dereference pointed out by Pluto Cobain.
It's for safety though I don't think it would occur.
Hiroshi Inoue [Tue, 8 Jul 2014 05:22:17 +0000 (14:22 +0900)]
Remove duplicated line in snprintf() which causes a crash introduced by
the commit
1177281049e8bb3df5992da5dc1ca31ad892082e.
Hiroshi Inoue [Mon, 7 Jul 2014 03:47:30 +0000 (12:47 +0900)]
Remove unsed dialog which was added by mistake.
Hiroshi Inoue [Fri, 13 Jun 2014 12:47:24 +0000 (18:32 +0545)]
Revise descriptor stuff.
descriptor.c(h) was broken by the commit
2da1668f4c7d7871a7212db10af606a7e646abd6
and it now causes a crash bug.
Instead of reverting the change revising the stuff completely.
Hiroshi Inoue [Fri, 4 Jul 2014 03:52:49 +0000 (12:52 +0900)]
Fix a memory leak pointed out by pluto.cobain.
Craig Ringer [Thu, 3 Jul 2014 06:03:19 +0000 (14:03 +0800)]
Remove the duplicate winbuild readme
Craig Ringer [Thu, 3 Jul 2014 05:56:44 +0000 (13:56 +0800)]
Remove obsolete .bat installer creators
Craig Ringer [Thu, 3 Jul 2014 04:59:07 +0000 (12:59 +0800)]
Document enabling MSDTC tracing
Craig Ringer [Thu, 3 Jul 2014 04:58:51 +0000 (12:58 +0800)]
Document build opts for SDK vs VS better
Hiroshi Inoue [Sun, 1 Jun 2014 10:08:28 +0000 (19:08 +0900)]
Add KeepaliveTime and KeepaliveInterval options to specify time or
interval for keepalive.
Hiroshi Inoue [Mon, 30 Jun 2014 11:59:22 +0000 (20:59 +0900)]
Remove PgDtc_set_property(.., prepareRequestded, 0) which causes a crash
in case PREPARE TRANSACTION error. The property prepareRequested isn't set
anywhere.
Craig Ringer [Wed, 25 Jun 2014 07:17:00 +0000 (15:17 +0800)]
Fix driver name mismatch between 32-bit ODBC app and 64-bit MSDTC host
If the 32-bit driver runs on a 64-bit host within a 32-bit app
running under SysWow64 then XA transactions will fail to recover.
That's because recovery is done by pgxalib.dll which runs within
MSDTC.exe - a 64-bit application. It connects to a DSN supplied
by psqlODBC in EnlistInDtc_1pipe during DTC enlistment by the
XA resource manager. This DSN uses the driver name of the client's
ODBC driver - which is fine so long as the client and MSDTC
architectures match. If they don't then MSDTC will fail to connect
to Pg, so it'll never resolve transactions.
Traces of MSDTC will show RM_COMMIT_DELIVERY_FAILED_DUE_TO_CONNECTION_DOWN
events.
Traces of pgxalib.dll will show xa_recover(..) being entered, followed by
"SQLDriverConnect return=-1".
To fix this, we detect if we're running under SysWow64 by examining the
PROCESSOR_ARCHITEW6432 environment variable and supply the 64-bit driver name
if so.
See mailing list thread:
http://www.postgresql.org/message-id/
53A45B59.70303@2ndquadrant.com
for details.
Craig Ringer
Heikki Linnakangas [Tue, 24 Jun 2014 13:38:00 +0000 (16:38 +0300)]
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.
Heikki Linnakangas [Tue, 24 Jun 2014 07:27:46 +0000 (10:27 +0300)]
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.
Hiroshi Inoue [Tue, 24 Jun 2014 03:22:15 +0000 (12:22 +0900)]
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.
Heikki Linnakangas [Mon, 23 Jun 2014 07:55:50 +0000 (10:55 +0300)]
Fix compilation on Windows, broken by my previous commit.
Michael Paquier
Heikki Linnakangas [Fri, 20 Jun 2014 16:43:20 +0000 (19:43 +0300)]
Refactor SQLCancel() and add comments, for readability.
Heikki Linnakangas [Fri, 20 Jun 2014 16:43:13 +0000 (19:43 +0300)]
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.
Hiroshi Inoue [Fri, 20 Jun 2014 02:09:19 +0000 (11:09 +0900)]
Fix broken buildX86-installer.ps1 due to the change to use psqlodbcm_cpu.wxs instead of psqlodbcm.wxs.
Hiroshi Inoue [Fri, 20 Jun 2014 03:19:45 +0000 (12:19 +0900)]
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.
Hiroshi Inoue [Fri, 20 Jun 2014 02:13:25 +0000 (11:13 +0900)]
Merge remote-tracking branch 'ringerc/fix-febe-protocol-desync-emptyquery'
Craig Ringer [Thu, 19 Jun 2014 05:56:57 +0000 (13:56 +0800)]
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.
Hiroshi Inoue [Sun, 1 Jun 2014 05:42:21 +0000 (14:42 +0900)]
Fix the problems using SQLFetch on prepared INSERT with RETURNING clause reported by John Smith.
Hiroshi Inoue [Sun, 1 Jun 2014 09:35:50 +0000 (18:35 +0900)]
Clear errors for prepared statement for subsequent exections.
Hiroshi Inoue [Thu, 19 Jun 2014 04:39:07 +0000 (10:24 +0545)]
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.
Heikki Linnakangas [Wed, 18 Jun 2014 18:08:07 +0000 (21:08 +0300)]
SQL_NUMERIC_STRUCT was not available until ODBC 3.0
Also add a prototype for ResolveNumericParam for readability.
Craig Ringer [Mon, 16 Jun 2014 13:16:31 +0000 (21:16 +0800)]
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.
Hiroshi Inoue [Mon, 16 Jun 2014 11:42:09 +0000 (20:42 +0900)]
ctype_length() is missing the length for SQL_C_BIGINT and SQL_C_NUMERIC(patch by John Smith <nukemd@hotmail.com>).
Craig Ringer [Mon, 16 Jun 2014 04:25:21 +0000 (12:25 +0800)]
Discuss issues with SDK support and installation
Craig Ringer [Mon, 16 Jun 2014 04:20:44 +0000 (12:20 +0800)]
Document build outputs
The build didn't explain what went where, or what to do about dependencies.
Improve the docs to cover the topic.
Hiroshi Inoue [Sun, 15 Jun 2014 12:22:29 +0000 (21:22 +0900)]
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.
U-Lenovo-PC\hiroshi [Sat, 14 Jun 2014 13:28:22 +0000 (22:28 +0900)]
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.
U-Lenovo-PC\hiroshi [Sat, 14 Jun 2014 12:53:57 +0000 (21:53 +0900)]
Fix potentially uninitialized local pointer access which causes
fatal compilation errors on vs2012/2013 reported by Craig Ringer.
Heikki Linnakangas [Fri, 13 Jun 2014 12:34:36 +0000 (15:34 +0300)]
Add top-level Windows makefile targets for building installers.
You can now do "nmake /f win64.mak world" to build both x86 and x64
versions of the installers in one command.
Hiroshi Inoue [Sun, 1 Jun 2014 04:02:10 +0000 (13:02 +0900)]
Make sure that the psqlodbc ANSI driver is ODBC3.5.
Hiroshi Inoue [Fri, 13 Jun 2014 02:51:40 +0000 (08:36 +0545)]
Changes by a patch and a request from Craig Ringer <craig@2ndquadrant.com>.
Applied a patch [ODBC] PATCH: WiX has moved.
Register 64bit XA DLL on installation per discussion with him.
Hiroshi Inoue [Sun, 1 Jun 2014 04:31:07 +0000 (13:31 +0900)]
Fix a PowerShell syntax error.
Also handle the case when GSSBINDIR parameter is given as an empty string in psqodbcm_cpu.wxs.
Heikki Linnakangas [Thu, 12 Jun 2014 18:55:03 +0000 (21:55 +0300)]
Support running regression tests on Windows.
Some tests fail, and numeric test crashes for me, but at least it's
relatively easy to run the suite on Windows now.
Michael Paquier and me
Heikki Linnakangas [Thu, 12 Jun 2014 14:02:18 +0000 (17:02 +0300)]
Fix ODBC function escape for SPACE function.
Also add a regression test case for SPACE and a few other ODBC function
escapes.
Heikki Linnakangas [Wed, 11 Jun 2014 21:43:48 +0000 (00:43 +0300)]
Silence compiler warnings from regression tests.
Three categories of warnings:
1. Missing return at end of main() function
2. Unused variables (copy-pasted from another test)
3. Data type mismatch in printfs, e.g. passing SQLULEN param to %d
Heikki Linnakangas [Wed, 11 Jun 2014 21:28:16 +0000 (00:28 +0300)]
Oops, forgot to git add some last-minute changes to the new regression test.
Heikki Linnakangas [Tue, 10 Jun 2014 10:35:05 +0000 (13:35 +0300)]
Rewrite the conversion functions between strings and SQL_NUMERIC_STRUCT.
Aside from making the functions more readable and faster, this fixes
a number of bugs:
1. When converting a large number from decimal to binary, the least
significant byte might be wrong (reported by Walter Couto)
2. In binary->decimal conversion, a number with small precision but large
scale caused a "Floating point exception".
3. In binary->decimal conversion, building the final string was wrong, picking
up "digits" from outside the reserved stack space, if scale was larger than 40
4. The param_string buffer allocated for the result of binary->decimal
conversion was too small.
Also add a test cases for all of these bugs.
Heikki Linnakangas [Mon, 9 Jun 2014 18:29:42 +0000 (21:29 +0300)]
Minor code cleanup.
The main change is to move the responsibility of adding the "length" header
to the QueryBuild from ResolveOneParam to its caller, when constructing the
parameters to send over to the server in a Bind message. ResolveOneParam
is complicated enough without that, so it seems more clear this way.
The rest is just fixes to the macros to make them deal with a "&qb" argument,
by adding parens around the macro argument. And while at it, clean up the
whitespace in them.
Heikki Linnakangas [Sat, 7 Jun 2014 18:48:46 +0000 (21:48 +0300)]
Misc whitespace and comment fixes. Remove dead, commented-out code.
For sake of readability.
Heikki Linnakangas [Wed, 4 Jun 2014 16:58:51 +0000 (19:58 +0300)]
Fix crash if connection is closed while sending a query to the server.
This is a similar bug that was fixed in commit
22b151eb. Some functions
reset conn->sock to NULL on a socket error, so we must not keep a copy of
it in a local variable. Also, SOCK_get_id should check for NULL argument
like all the rest of the SOCK_get/put_* functions.
Heikki Linnakangas [Wed, 4 Jun 2014 07:42:16 +0000 (10:42 +0300)]
Remove unused NDEBUG and PSQLODBC_EXPORTS defines from makefiles.
Heikki Linnakangas [Wed, 4 Jun 2014 07:24:22 +0000 (10:24 +0300)]
Remove more unused stuff from win64.mak
Heikki Linnakangas [Tue, 3 Jun 2014 16:37:21 +0000 (19:37 +0300)]
Silence misc issues flagged up by Clang's static analyzer, scan-build
Heikki Linnakangas [Tue, 3 Jun 2014 14:57:35 +0000 (17:57 +0300)]
Using tolower() requires ctype.h with some compilers.
gcc and MSVC were happy without it, but clang warns.
Heikki Linnakangas [Tue, 3 Jun 2014 14:52:49 +0000 (17:52 +0300)]
Merge 32-bit and 64-bit .wxs files used to build the .MSM files on Windows
Heikki Linnakangas [Tue, 3 Jun 2014 13:56:03 +0000 (16:56 +0300)]
Unify the 32-bit and 64-bit installer build processes.
Use the same .wxs file for both builds. The MSM files is still generated
differently, but this is a step in the right direction.
Heikki Linnakangas [Tue, 3 Jun 2014 12:38:28 +0000 (15:38 +0300)]
Fix Debug-mode builds with win64.mak
It apparently hasn't worked for a very long time. Copy some tricks from
the already-deleted win32.mak to make it work: Use /MDd rather than /MD
when compiling in Debug mode, and replace /GZ with /RTC1, to silence a
deprecation warning from the compiler
Heikki Linnakangas [Tue, 3 Jun 2014 09:35:49 +0000 (12:35 +0300)]
Fix Windows build with MSDTC=no.
Heikki Linnakangas [Tue, 3 Jun 2014 08:23:26 +0000 (11:23 +0300)]
Rename Windows output folders, for clarity.
Heikki Linnakangas [Tue, 3 Jun 2014 07:38:28 +0000 (10:38 +0300)]
Remove obsolete Windows build files.
buildx86.ps1 and buildx64.ps1 were used to invoke the nmake makefiles, but
have been obsoleted by the scripts in winbuild/. win64.mak can be used to
build 32-bit and 64-bit binaries now, so win32.mak is no longer needed.
Heikki Linnakangas [Mon, 2 Jun 2014 19:23:26 +0000 (22:23 +0300)]
Simplify win32.mak and win64.mak a little bit.
Change the way we test whether a directory exists, so that we don't need
a version check for Windows NT. (although we probably don't need to support
compiling on NT anymore anyway)
Heikki Linnakangas [Mon, 2 Jun 2014 17:48:47 +0000 (20:48 +0300)]
Improve Windows compilation instructions in the docs.
Heikki Linnakangas [Mon, 2 Jun 2014 17:16:49 +0000 (20:16 +0300)]
Refactor win64.mak to allow passing options in local file.
Move all the default values for external library paths to
windows-defaults.mak. Add an include for file called windows-local.mak,
this allows you to put local config options in that file, which is much
easier than passing them on the command line every time.
Heikki Linnakangas [Mon, 2 Jun 2014 17:03:51 +0000 (20:03 +0300)]
Remove /incremental option from linker call on Windows / nmake
The linker defaults to what were passing, so should work fine without it.
Also remove an unused variable from win32.mak
Heikki Linnakangas [Mon, 2 Jun 2014 16:19:10 +0000 (19:19 +0300)]
Remove special check for nmake version 6.00.9782.0
Surely we don't need to support that old versions anymore. Besides, it
was bizarre to check for that exact version, and not any older or newer
versions of that era.
Heikki Linnakangas [Mon, 2 Jun 2014 16:13:47 +0000 (19:13 +0300)]
Remove unused cruft from Windows build files.
Heikki Linnakangas [Mon, 2 Jun 2014 15:51:37 +0000 (18:51 +0300)]
Add comments to modify_msi.vbs.
It took me quite a while to reverse-engineer what it does, and more
importantly, why. Add comment to save time for the next reader.
Heikki Linnakangas [Mon, 2 Jun 2014 10:33:46 +0000 (13:33 +0300)]
Clean up Windows makefiles
Get rid of the CPU and CPUTYPE variables in win64.mak. Instead, assume that
the TARGET_CPU variable has been set correctly in the environment.
TARGET_CPU is set by "setenv" script that comes with the Microsoft Visual
Studio C compiler package. It never worked to pass a "CPU=x86" and using a
x64 compiler, for example, so seems better to determine the correct target
from the environment, than fail with a cryptic error message if the CPU
argument and the environment don't match. To build 32-bit binaries with
win64.mak, simply do "setenv /x86" before running "nmake -f win64.mak".
Similarly, to build 64-bit binaries, use "setenv /x64".
It should now be possible to build both 32-bit and 64-bit binaries with
win64.mak. Ideally, we could now remove win32.mak altogether, but there are
small differences between win64.mak and win32.mak in the build options that
they use. I don't understand the differences enough to dare to remove
win32.mak yet.
The CPU=AMD64 alias for x64 is no longer supported (as the whole parameter
is now gone).
Also do whitespace & other cosmetic fixes to win32.mak and win64, to make
them more similar. This helps when comparing the two with "diff".
Remove remains of the long-gone "MULTIBYTE" setting (it was misspelled in
win64.mak, anyway)