psqlodbc.git
11 years agoAvoid double-free() bug.
Heikki Linnakangas [Tue, 12 Nov 2013 13:49:50 +0000 (15:49 +0200)]
Avoid double-free() bug.

Spotted by Fortify static analysis tool.

11 years agoImprove the help message of configure script.
Hiroshi Inoue [Sat, 9 Nov 2013 03:58:23 +0000 (12:58 +0900)]
Improve the help message of configure script.

11 years agoSuppress compiler warnings.
Hiroshi Inoue [Fri, 8 Nov 2013 12:47:57 +0000 (21:47 +0900)]
Suppress compiler warnings.

11 years agoUse with_xxxxx (xxxxx is the package name) variables directly instead of the withval...
Hiroshi Inoue [Wed, 6 Nov 2013 13:21:40 +0000 (22:21 +0900)]
Use with_xxxxx (xxxxx is the package name) variables directly instead of the withval variable.

11 years agowinres.h instead of afxres.h. There are some cases (VS 2012 express etc) when afxres...
Hiroshi Inoue [Wed, 6 Nov 2013 12:27:29 +0000 (21:27 +0900)]
winres.h instead of afxres.h. There are some cases (VS 2012 express etc) when afxres.h doesn't exist.

11 years agoRename the name of elements in configuration(_template).xml from
Hiroshi Inoue [Mon, 4 Nov 2013 13:08:03 +0000 (22:08 +0900)]
Rename the name of elements in configuration(_template).xml from
setenv to setvcvars.

11 years agoWhen nmake macros are given as command line parameters, they can't be changed.
Hiroshi Inoue [Mon, 4 Nov 2013 12:58:10 +0000 (21:58 +0900)]
When nmake macros are given as command line parameters, they can't be changed.

11 years agoVOID is not defined on all systems. Use void insted.
Heikki Linnakangas [Sun, 3 Nov 2013 08:31:44 +0000 (10:31 +0200)]
VOID is not defined on all systems. Use void insted.

Christoph Berg

11 years agoChange conifuration_template.xml so that its 64bit default is use_sspi=yes,
Hiroshi Inoue [Thu, 31 Oct 2013 12:46:15 +0000 (21:46 +0900)]
Change conifuration_template.xml so that its 64bit default is use_sspi=yes,
 use_gss=no. Also add the treatment of libpq default version.

11 years agoAdd support for verify-ca/full sslmode using Windows Schannel Security
Hiroshi Inoue [Sat, 26 Oct 2013 11:45:39 +0000 (20:45 +0900)]
Add support for verify-ca/full sslmode using Windows Schannel Security
Service Provider.
Root CAs must be installed into Windows Root certificate store beforehand.

11 years agoFix the newly-introduced CORR_STRCPY and CORR_VALCPY macros.
Heikki Linnakangas [Mon, 28 Oct 2013 10:48:35 +0000 (12:48 +0200)]
Fix the newly-introduced CORR_STRCPY and CORR_VALCPY macros.

They were broken, did not compile.

Michael Paquier

11 years agoFix a bug in CC_copy_conninfo() that free()s password item of input source
Hiroshi Inoue [Fri, 25 Oct 2013 05:35:52 +0000 (14:35 +0900)]
Fix a bug in CC_copy_conninfo() that free()s password item of input source
unexpectedly.
Change CC_copy_conninfo() and copy_globals() so that they copy each item
one by one.

11 years agoOK I found the way to handle private keys of PEM form using CryptoAPI.
Hiroshi Inoue [Thu, 24 Oct 2013 08:49:58 +0000 (17:49 +0900)]
OK I found the way to handle private keys of PEM form using CryptoAPI.
Certificates of PFX form are no longer needed for SSL client certificate
authntication.

11 years agoConcentrate the settings of Windows build system to an xml file and
Hiroshi Inoue [Tue, 22 Oct 2013 13:40:57 +0000 (22:40 +0900)]
Concentrate the settings of Windows build system to an xml file and
build binaries or installers with reference to it.

(configuration.xml)
xml file to specify the setting of the build environment.
It is automatically generated in winbuild folder as a copy
of winbuild/configuration_template.xml when you invoke
editConfiguration script firstly.

winbuild/configuration.ps1 modules to handle the configuration file
winbuild/editConfiguration.ps1 edit configuration file (GUI)
winbuild/editConfiguration.bat same as above with a minimized console window

buildx86.ps1 build 32bit binary
buildx64.ps1 build 64bit binary

installer/buildx86-installer.ps1 build 32bit installer
installer/buildx64-installer.ps1 build 64bit installer

11 years agoChange Windows installer build system for the next release.
Hiroshi Inoue [Tue, 22 Oct 2013 13:21:56 +0000 (22:21 +0900)]
Change Windows installer build system for the next release.

Change to specify ProductCode for each version so as not to forget to change
ProductCode in case of major version up.
Remove VC runtime merge modules from the installer(runtime dlls will be
installed via psqlodbc setup program).

[64bit version only]
Use libpq by default
Remove GSSAPI support by default

11 years agoHandle SSL client certificate authentication in Windows Schannel security
Hiroshi Inoue [Tue, 22 Oct 2013 08:51:50 +0000 (17:51 +0900)]
Handle SSL client certificate authentication in Windows Schannel security
support provider.

You have to place the certificate file postgresql.pfx (PFX or PKCS12 format)
in %APPDATA%\postgresql folder instead of postgresql.crt and postgresql.key
(I wasn't able to find the way to handle PEM format using Cryptography API
unfortunately).
You can create the file using the following command.
 openssl pkcs12 -export -in postgresql.crt -inkey postgresql.key
 -out postgresql.pfx (with empty password).

12 years agoWhen LF->CR+LF conversion causes an buffer truncation, supress the conversion (in...
Hiroshi Inoue [Thu, 22 Aug 2013 11:40:01 +0000 (20:40 +0900)]
When LF->CR+LF conversion causes an buffer truncation, supress the conversion (in case of unicode).

12 years agoDon't issue a BEGIN when running VACUUM in auto-commit mode.
Heikki Linnakangas [Mon, 2 Sep 2013 10:20:02 +0000 (13:20 +0300)]
Don't issue a BEGIN when running VACUUM in auto-commit mode.

Normally in auto-commit mode the driver begins a new transaction
implicitly at the first statement, by sending a BEGIN statement. However,
some commands, like VACUUM, cannot be run in a transaction block, and you
will get an error like "VACUUM cannot run inside a transaction block" from
the server. In UseServerSidePrepare=0 mode, the code looks at the first word
of the query to determine if the statement is one of the special ones, and
if so, didn't begin a new transaction even when auto-commit mode is
disabled. However, in UseServerSidePrepare=1 mode, when using SQLPrepare/
SQLExecute to run the VACUUM, that check was not made. Fix that.

There was one more related inconsistency between UseServerSidePrepare modes.
Without server-side-prepares, if you issued an explicit BEGIN in auto-commit
mode, the implicit BEGIN was ont sent. But without server-side prepares, it
was. It seems best to send the implicit BEGIN in both cases, because then
you get a warning from the backend about the second BEGIN. That's a good
thing, because a sane ODBC application should be using the ODBC function
SQLEndTran() for transaction control, not explicit BEGIN/COMMIT.

Also add a test case for executing VACUUM, with and without autocommit.

12 years agoAdd test case for interleaving operations on several prepared statements.
Heikki Linnakangas [Mon, 2 Sep 2013 08:29:46 +0000 (11:29 +0300)]
Add test case for interleaving operations on several prepared statements.

12 years agoAdd test case for SQLDescribeParam
Heikki Linnakangas [Mon, 2 Sep 2013 08:29:41 +0000 (11:29 +0300)]
Add test case for SQLDescribeParam

12 years agoRemove useless 'sync' parameter from prepareParameters() function.
Heikki Linnakangas [Mon, 2 Sep 2013 08:29:28 +0000 (11:29 +0300)]
Remove useless 'sync' parameter from prepareParameters() function.

It was always passed as TRUE.

12 years agoAdd preliminary release notes for upcoming 9.3 release.
Heikki Linnakangas [Thu, 22 Aug 2013 07:11:16 +0000 (10:11 +0300)]
Add preliminary release notes for upcoming 9.3 release.

This doesn't cover everything yet, but it's a start.

12 years agoChange the default for UseServerSidePrepare to 1.
Heikki Linnakangas [Thu, 22 Aug 2013 06:58:02 +0000 (09:58 +0300)]
Change the default for UseServerSidePrepare to 1.

The docs have recommended UseServerSidePrepare=1 for server versions 7.4
onwards, so it seems prudent to change the default so that people don't need
to remember to specify it manually.

With UseServerSidePrepare=1, the "insertreturning" regression test case
behaves better, ie. SQLNumResultCols() correctly returns the number of
columns for an INSERT RETURNING statement, even when called before
SQLExecute(). Hence change the expected output. I'm not 100% if the behavior
with UseServerSidePrepare=0 was even correct, so I'm not adding an
alternative expected output file for it.

12 years agoFix bug when a statement is executed twice with data-at-execution params.
Heikki Linnakangas [Thu, 22 Aug 2013 06:47:07 +0000 (09:47 +0300)]
Fix bug when a statement is executed twice with data-at-execution params.

When a statement with array-bound data-at-execution parameters is executed
twice, the second result set was not returned when UseServerSidePrepare=1.
This was demonstrated by the data-at-execution regression test case.

12 years agoAdd test case for testing the effect of COMMIT/ROLLBACK on cursors.
Heikki Linnakangas [Wed, 21 Aug 2013 12:37:33 +0000 (15:37 +0300)]
Add test case for testing the effect of COMMIT/ROLLBACK on cursors.

The behavior differs depending on UseDeclareFetch, so there are two expected
outputs for this.

12 years agoAdd test case for multi-statements.
Heikki Linnakangas [Tue, 20 Aug 2013 21:11:30 +0000 (00:11 +0300)]
Add test case for multi-statements.

12 years agoRemove common.o on "make clean"
Heikki Linnakangas [Tue, 20 Aug 2013 21:00:13 +0000 (00:00 +0300)]
Remove common.o on "make clean"

12 years agoHandle turning standard_conforming_strings to off in mid-session.
Heikki Linnakangas [Tue, 20 Aug 2013 20:26:30 +0000 (23:26 +0300)]
Handle turning standard_conforming_strings to off in mid-session.

We already watched for a ParameterStatus response indicating that
standard_conforming_strings was turned on, and acted accordingly, but
if it was turned off, we did nothing. Fix that.

Also add a test case for that.

12 years agoAdd test case for using SQLBindParameter with SQLExecDirect.
Heikki Linnakangas [Tue, 20 Aug 2013 19:41:53 +0000 (22:41 +0300)]
Add test case for using SQLBindParameter with SQLExecDirect.

12 years agoRemove some dead code.
Heikki Linnakangas [Tue, 20 Aug 2013 10:44:53 +0000 (13:44 +0300)]
Remove some dead code.

12 years agoOops, used wrong #ifdef for CC_Copy.
Heikki Linnakangas [Tue, 20 Aug 2013 04:46:31 +0000 (07:46 +0300)]
Oops, used wrong #ifdef for CC_Copy.

CC_Copy is needed if _HANDLE_ENLIST_IN_DTC_ is used, regardless of
CLEANUP_CONN_BEFORE_ISOLATION. That caused compilation on Windows to fail.

12 years agoSilence misc compiler warnings.
Heikki Linnakangas [Thu, 15 Aug 2013 10:12:15 +0000 (13:12 +0300)]
Silence misc compiler warnings.

Also a few comment typo and whitespace fixes.

12 years agoConfigure is checking SIZEOF_LONG not SIZEOF_LONG_INT.
Hiroshi Inoue [Wed, 24 Jul 2013 15:07:58 +0000 (00:07 +0900)]
Configure is checking SIZEOF_LONG not SIZEOF_LONG_INT.

12 years agoThe first cut of psqlodbc setup project. It builds a setup program which
Hiroshi Inoue [Sun, 14 Jul 2013 11:51:17 +0000 (20:51 +0900)]
The first cut of psqlodbc setup project. It builds a setup program which
can't be done by a single MSI. It would install VC++ redistributable, 32
bit psqlodbc driver and 64 bit psqlodbc driver (on 64 bit windows).

12 years agoChange configure.ac so that ODBC_CONFIG is set when neither unixODBC nor
Hiroshi Inoue [Sat, 13 Jul 2013 09:29:50 +0000 (18:29 +0900)]
Change configure.ac so that ODBC_CONFIG is set when neither unixODBC nor
iODBC is explicitly specified.

12 years agoIgnore automatically-generated files in source code with .gitignore.
Hiroshi Inoue [Wed, 10 Jul 2013 14:32:24 +0000 (23:32 +0900)]
Ignore automatically-generated files in source code with .gitignore.
This is useful to prevent accidental commit of files that are not wanted
in the remote repository. The original patch was provided by Michael
Paquier. I also added files genearated by VC build tools or WIX tools
to .gitignore.

12 years agoRevise MSDTC support.
Hiroshi Inoue [Fri, 21 Jun 2013 04:09:06 +0000 (13:09 +0900)]
Revise MSDTC support.
1. Remove pointlessly complicated AsyncThreads stuff. Instead use
   _beginthread() to clean up threads.
2. Make pgenlist.dll from the structure change of ConnectionClass.
   The driver dlls exports the functions described in connexp.h
   which are used by pgenlist.dll.

3. Isolate the current communication path if necessary.
   While an IAsyncPG object is alive, a ConnectionClass object (hereinafter
   refered to as conn-obj) is assigned to it. The assignment has to be
   changed in the following cases.

   a) SQLDisconnect() is called for the current connection handle which
      is assigned to an IAsyncPG object.
Allocate another conn-obj and move the current communication
path (*sock* member of the current conn-obj) to the new conn-obj.
The communicaation path is lost from the current conn-obj and
the new conn-obj is assigned to the IAsyncPG object.

   b) Another (global) transaction is about to begin but the current
      global transaction is not PREPARED yet.
Same as case a) but will open a new communication path for
the current conn-obj for the subsequent ODBC API calls.

   c) Another (global) transaction is about to begin and the current
      global transaction is already PREPARED.
Allocate another conn-obj and open a new communication path for
the conn-obj. The new conn-obj is assigned to the IAsyncPG
object only to issue COMMIT/ROLLBACK PREPARED command.

   communication pass (*sock* member of the current ConnectionClass
   object) to the new object and change the state of the current
   object NOT CONNECTED. The IAsyncPG object uses new object instead
   of the current object. In case b) the current object will open a
   new communication path.

12 years agoReduce the memory usage of ConnectinClass objects by changing their large
Hiroshi Inoue [Fri, 21 Jun 2013 03:45:40 +0000 (12:45 +0900)]
Reduce the memory usage of ConnectinClass objects by changing their large
 fixed length text fields to variable ones. Because changes are applied to
 percent-encoded fields this time, password field is also a target of this
 change.

12 years agoChange SQL_ATTR_PARAMS_PROCESSED_PTR attribute which is set by SQLSetStmtAttr() from...
Hiroshi Inoue [Mon, 17 Jun 2013 21:51:24 +0000 (06:51 +0900)]
Change SQL_ATTR_PARAMS_PROCESSED_PTR attribute which is set by SQLSetStmtAttr() from (SQLUINTEGER *) to (SQLULEN *). This fixes the bug reported by Christopf Berg. Also verify similar attributes which were changed from SQL(U)INTEGER (*) to SQL(U)LEN (*) when 64bit ODBC was introduced.

12 years agoSQL_C_SLONG stands for SQLINTEGER not long.
Hiroshi Inoue [Fri, 14 Jun 2013 22:09:51 +0000 (07:09 +0900)]
SQL_C_SLONG stands for SQLINTEGER not long.

12 years agoFix uninitialized use of 'allocbuf' variable, in case of out-of-memory.
Heikki Linnakangas [Wed, 12 Jun 2013 11:03:37 +0000 (14:03 +0300)]
Fix uninitialized use of 'allocbuf' variable, in case of out-of-memory.

Compiler warned about this. If ENLARGE_NEWSTATEMENT macro ran out of memory,
it would jump to cleanup routine. The cleanup would check if allocbuf is
NULL, and try to free() it if not. allocbuf needs to be initialized to NULL
before the first ENLARGE_NEWSTATEMENT macro invocation.

12 years agoChange release date. REL-09_02_0100
Hiroshi Saito [Sun, 2 Jun 2013 13:05:53 +0000 (22:05 +0900)]
Change release date.

12 years agoadd change history.
Hiroshi Saito [Sun, 2 Jun 2013 13:04:42 +0000 (22:04 +0900)]
add change history.

12 years agoMake sure accesses to a connection from multiple threads are exclusive. This change...
Hiroshi Inoue [Sun, 2 Jun 2013 01:29:35 +0000 (10:29 +0900)]
Make sure accesses to a connection from multiple threads are exclusive. This change fixes the problem *UseDeclareFetch=1, Fetch=100, UseServerSidePrepare=1 causes Windows client to intermittently hang* reported by Jack Wilson. I hope it would also fix the problem *Segmentation Fault in Postgres server when using psqlODBC* reported by Joshua Berry.

12 years agoinclude VS2010 Merge Modules.
Hiroshi Saito [Tue, 28 May 2013 16:14:57 +0000 (01:14 +0900)]
include VS2010 Merge Modules.

12 years agoVS2010 module support at postgresql 9.2. per report jack(ljwilson).
Hiroshi Saito [Sun, 26 May 2013 09:10:33 +0000 (18:10 +0900)]
VS2010 module support at postgresql 9.2. per report jack(ljwilson).

12 years agoadd test modules.
Hiroshi Saito [Sun, 26 May 2013 06:24:27 +0000 (15:24 +0900)]
add test modules.

12 years agoadd change history.
Hiroshi Saito [Sun, 26 May 2013 06:15:16 +0000 (15:15 +0900)]
add change history.

12 years agoFix the *cursor XXXXXXXX already exists* error when handling *with cte* statements...
Hiroshi Inoue [Sat, 25 May 2013 21:33:37 +0000 (06:33 +0900)]
Fix the *cursor XXXXXXXX already exists* error when handling *with cte* statements reported by Joe Conway.

12 years agoOptimal some modification.
Hiroshi Saito [Tue, 21 May 2013 14:01:35 +0000 (23:01 +0900)]
Optimal some modification.

12 years agoApply blank date <-> null conversion functionality to timestamp type as well.
Hiroshi Inoue [Tue, 21 May 2013 12:28:10 +0000 (21:28 +0900)]
Apply blank date <-> null conversion functionality to timestamp type as well.

12 years agoAvoid a conflict between winsock2.h and winsock.h? in socket.c.
Hiroshi Inoue [Tue, 21 May 2013 12:24:12 +0000 (21:24 +0900)]
Avoid a conflict between winsock2.h and winsock.h? in socket.c.

12 years agoAllow special characters in the password value of a connection string
Hiroshi Inoue [Mon, 20 May 2013 12:31:58 +0000 (21:31 +0900)]
Allow special characters in the password value of a connection string
by enclosing the value by braces({}).

12 years agoDon't #include errno.h on Windows. VC10 or later intentionally changed
Hiroshi Inoue [Mon, 20 May 2013 11:23:13 +0000 (20:23 +0900)]
Don't #include errno.h on Windows. VC10 or later intentionally changed
the values of error numbers like EINTR, EWOULDBLOCK.

12 years agochange lib name by 9.2.
Hiroshi Saito [Sun, 19 May 2013 09:34:37 +0000 (18:34 +0900)]
change lib name by 9.2.

12 years agochange lib name by 9.2.
Hiroshi Saito [Sun, 19 May 2013 09:30:44 +0000 (18:30 +0900)]
change lib name by 9.2.

12 years agoPrep release version 09.02.0100
Hiroshi Saito [Sat, 18 May 2013 15:06:06 +0000 (00:06 +0900)]
Prep release version 09.02.0100

12 years agoadd the change history.
Hiroshi Saito [Thu, 16 May 2013 00:07:27 +0000 (09:07 +0900)]
add the change history.

12 years agoMerge branch 'snapshot'
Hiroshi Inoue [Tue, 14 May 2013 13:55:36 +0000 (22:55 +0900)]
Merge branch 'snapshot'

12 years agoFix a problem reported by Jack Wilson(ljwilson@digitalav.com).
Hiroshi Inoue [Tue, 14 May 2013 13:53:47 +0000 (22:53 +0900)]
Fix a problem reported by Jack Wilson(ljwilson@digitalav.com).
When DeUseDeclareFetch=1 and UseServerSidePrepare=1, issue COMMIT commands properly in case of AUTOCOMMIT on mode,

12 years agocommit check
Hiroshi Saito [Mon, 13 May 2013 14:22:34 +0000 (23:22 +0900)]
commit check

12 years agoAdd history prep release.
Saito Hiroshi [Mon, 13 May 2013 13:55:50 +0000 (22:55 +0900)]
Add history prep release.

12 years agoMake the MSI build process of 32bit drivers available in 64bit mode also.
Hiroshi Inoue [Fri, 10 May 2013 22:07:24 +0000 (07:07 +0900)]
Make the MSI build process of 32bit drivers available in 64bit mode also.

12 years agoAvoid a gpf on Windows reported by Jack Wilson(ljwilson@digitalav.com).
Hiroshi Inoue [Thu, 2 May 2013 11:43:36 +0000 (20:43 +0900)]
Avoid a gpf on Windows reported by Jack Wilson(ljwilson@digitalav.com).
It occurs only when DeUseDeclareFetch=1 and UseServerSidePrepare=Parse=DisallowPremature=0. This change corrects the behavior of automatcally closed non-holdable cursors.

12 years agoFix bug with VARCHAR(5) parameter and UseServerSidePrepare=0
Heikki Linnakangas [Wed, 24 Apr 2013 15:35:54 +0000 (18:35 +0300)]
Fix bug with VARCHAR(5) parameter and UseServerSidePrepare=0

If you passed a VARCHAR parameter with column_size 5 to SQLPrepare, and you
had UseServerSideprepare=0 and BoolsAsChar=1, the code describes the
parameters before running the query, so that it can check if the parameter
is a boolean. That produced a bogus extra empty result set to the caller in
subsequent SQLExecute().

This fixes the two regression test failures.

Patch by Hiroshi Inoue, with minor copy-editing by me.

12 years agoAdd regression test suite.
Heikki Linnakangas [Wed, 24 Apr 2013 15:05:29 +0000 (18:05 +0300)]
Add regression test suite.

Two tests are currently failing, because they hit a real bug in the driver.
After the bug is fixed, the tests should pass.

This doesn't work on Windows yet.

12 years agoTeach installer that the FAQs and HOWTOs are not in this repository anymore.
Heikki Linnakangas [Wed, 24 Apr 2013 15:03:58 +0000 (18:03 +0300)]
Teach installer that the FAQs and HOWTOs are not in this repository anymore.

12 years agoSilence some compiler warnings, when building on Windows.
Heikki Linnakangas [Wed, 24 Apr 2013 06:06:18 +0000 (09:06 +0300)]
Silence some compiler warnings, when building on Windows.

12 years agoAdd items to release notes, for things I've fixed recently.
Heikki Linnakangas [Tue, 23 Apr 2013 16:10:24 +0000 (19:10 +0300)]
Add items to release notes, for things I've fixed recently.

12 years agoImprove formatting of release notes.
Heikki Linnakangas [Tue, 23 Apr 2013 15:54:57 +0000 (18:54 +0300)]
Improve formatting of release notes.

12 years agoMove release notes for 7.3 and below to separate files.
Heikki Linnakangas [Tue, 23 Apr 2013 15:41:46 +0000 (18:41 +0300)]
Move release notes for 7.3 and below to separate files.

That's ancient history by now, so seems reasonable to make it less
prominent.

12 years agoFix "make dist" target, now that some of the documentation files are gone.
Heikki Linnakangas [Tue, 23 Apr 2013 13:14:44 +0000 (16:14 +0300)]
Fix "make dist" target, now that some of the documentation files are gone.

12 years agoFix typo in docs.
Heikki Linnakangas [Tue, 23 Apr 2013 13:12:54 +0000 (16:12 +0300)]
Fix typo in docs.

12 years agoRemove documentation files that were moved to the new psqlodbc-www repository.
Heikki Linnakangas [Tue, 23 Apr 2013 12:07:06 +0000 (15:07 +0300)]
Remove documentation files that were moved to the new psqlodbc-www repository.

The version-specific files are kept in this repository, so that they are
kept in sync with the code.

12 years agoImprove the handing of installation errors.
Hiroshi Inoue [Sat, 20 Apr 2013 11:32:51 +0000 (20:32 +0900)]
Improve the handing of installation errors.

12 years agoFix a DataSource registration crash bug on 64bit Windows.
Hiroshi Inoue [Sat, 20 Apr 2013 11:26:45 +0000 (20:26 +0900)]
Fix a DataSource registration crash bug on 64bit Windows.

12 years agoFix column size info of MACADDR, CIDR or INET type.
Hiroshi Inoue [Thu, 28 Mar 2013 02:36:44 +0000 (11:36 +0900)]
Fix column size info of MACADDR, CIDR or INET type.

12 years agoFix SQLPrepare() -> SQLDescibeCol() -> SQLPrepare() without SQLExecute() case.
Hiroshi Inoue [Thu, 28 Mar 2013 02:30:12 +0000 (11:30 +0900)]
Fix SQLPrepare() -> SQLDescibeCol() -> SQLPrepare() without SQLExecute() case.

12 years agoAdd some NULL checks to avoid crash.
Hiroshi Inoue [Mon, 14 Jan 2013 05:36:51 +0000 (14:36 +0900)]
Add some NULL checks to avoid crash.

12 years agoFix the bug reported by Bernhard Goebel. When fetching a row "behind" the rowset...
Hiroshi Inoue [Mon, 14 Jan 2013 05:29:54 +0000 (14:29 +0900)]
Fix the bug reported by Bernhard Goebel. When fetching a row "behind" the rowset by "fetch absolute" only the first ones of the result set can be fetched. "First ones" means: row 1 to row X are readable furthermore, where X is the value used with the FETCH parameter in SQLDriverConnect.

12 years agoFix the bug about empty bytea values reported by Nils Gsche.
Hiroshi Inoue [Mon, 14 Jan 2013 05:17:36 +0000 (14:17 +0900)]
Fix the bug about empty bytea values reported by Nils Gsche.

12 years agoAdd missing comparison
Hiroshi Inoue [Sat, 20 Apr 2013 11:14:59 +0000 (20:14 +0900)]
Add missing comparison

12 years agoChange permissions on 'bootstrap' to make it executable.
Heikki Linnakangas [Thu, 18 Apr 2013 20:11:52 +0000 (23:11 +0300)]
Change permissions on 'bootstrap' to make it executable.

12 years agoAvoid multiple evaluation in some macros.
Heikki Linnakangas [Thu, 18 Apr 2013 20:03:11 +0000 (23:03 +0300)]
Avoid multiple evaluation in some macros.

There was at least one real bug caused by the multiple evaluation of 2nd
argument to SC_set_result(). SC_pre_execute() passed QR_Constructor() call
as the 2nd argument, so we ended up creating extra result sets that were
leaked.

12 years agoChange the way chained result sets are free'd, to avoid recursion.
Heikki Linnakangas [Thu, 18 Apr 2013 20:02:59 +0000 (23:02 +0300)]
Change the way chained result sets are free'd, to avoid recursion.

If you have a lot of chained results, e.g. if you array bind a lot of
parameters, recursing through the whole chain might make you run out of
stack space. Convert recursion to iteration.

Also, when we're freeing all the results in the chain, we only need to
call QR_set_cursor(self, NULL) once, on the first result in the chain.
QR_set_cursor itself loops through the whole chain, resetting the cursor
name of every result. By only calling it for the first result, we avoid
O(n^2) behavior, significantly speeding up SQLFreeHandle() on a statement
with a large number of chained results.

12 years agoFormat if-statement with commented out "then"-block differently.
Heikki Linnakangas [Thu, 18 Apr 2013 20:02:20 +0000 (23:02 +0300)]
Format if-statement with commented out "then"-block differently.

To silence a Coverity warning that the semicolon might be misplaced.

12 years agoSilence compiler warning that bmp variable might be used uninitialized.
Heikki Linnakangas [Thu, 18 Apr 2013 20:01:57 +0000 (23:01 +0300)]
Silence compiler warning that bmp variable might be used uninitialized.

It wasn't actually true, but apparently not all compiler versions were smart
enough to realize it.

12 years agoSilence warning about sscanf format vs var type mismatch on 32-bit systems.
Heikki Linnakangas [Thu, 18 Apr 2013 19:37:15 +0000 (22:37 +0300)]
Silence warning about sscanf format vs var type mismatch on 32-bit systems.

12 years agoMark these two structs as const.
Heikki Linnakangas [Thu, 18 Apr 2013 19:36:50 +0000 (22:36 +0300)]
Mark these two structs as const.

It's a good habit to mark constants as such. But I'm also hoping that this
would silence Coverity from complaining that ver2str and ver3str might
not fit in 6 bytes.

12 years agoRestructure < 7.4 protocol code a bit.
Heikki Linnakangas [Thu, 18 Apr 2013 19:36:34 +0000 (22:36 +0300)]
Restructure < 7.4 protocol code a bit.

This avoids accessing unitialized bitmap[0]. It was harmless, as the
uninitialize value that was read was not used for anything, but Coverity
complained about it.

12 years agoInitialize field to silence a Coverity false positive.
Heikki Linnakangas [Thu, 18 Apr 2013 19:36:05 +0000 (22:36 +0300)]
Initialize field to silence a Coverity false positive.

Coverity doesn't like the fact that the struct is passed to
SC_set_rowset_start without initializing rowset_start field. It's OK,
SC_set_rowset_start doesn't actually use the 'incr' value calculated from
the field if the 3rd arg is FALSE, so this is a false positive, but seems
like a good idea to be tidy here anyway.

12 years agoRemove spurious 'break'.
Heikki Linnakangas [Thu, 18 Apr 2013 19:35:36 +0000 (22:35 +0300)]
Remove spurious 'break'.

Found by Coverity scan.

12 years agoAdd NULL-check, to silence a Coverity problem.
Heikki Linnakangas [Thu, 18 Apr 2013 19:35:20 +0000 (22:35 +0300)]
Add NULL-check, to silence a Coverity problem.

The problem is that if the loop above doesn't find a result set with
command tag "FETCH ...", res is left to point to an already-freed result
set, and we'll go ahead and call QR_set_withhold on the already-freed
struct. That can't happen in practice, because the backend does always
return a result set with "FETCH ..." command tag when a FETCH statement is
issued, but better safe than sorry.

12 years agoRemove useless null-check.
Heikki Linnakangas [Thu, 18 Apr 2013 19:35:04 +0000 (22:35 +0300)]
Remove useless null-check.

We reference the same pointer without null-check elsewhere in the function,
so if it's ever NULL, we'll crash anyway. (but looking at the callers, it
never is NULL)

Found by Coverity scan.

12 years agoDon't crash if getpwuid() returns NULL.
Heikki Linnakangas [Thu, 18 Apr 2013 19:34:40 +0000 (22:34 +0300)]
Don't crash if getpwuid() returns NULL.

Found by Coverity scan.

12 years agoHandle realloc failures gracefully.
Heikki Linnakangas [Thu, 18 Apr 2013 19:34:17 +0000 (22:34 +0300)]
Handle realloc failures gracefully.

If realloc fails and returns NULL, don't forget the old array. Also check
for overflow of num_Stmts, which is only a 16-bit int

12 years agoRemove unused variable, to silence compiler warning.
Heikki Linnakangas [Thu, 18 Apr 2013 19:33:56 +0000 (22:33 +0300)]
Remove unused variable, to silence compiler warning.

12 years agoSilence compiler warnings about unused msg_truncated variables.
Heikki Linnakangas [Thu, 18 Apr 2013 19:33:40 +0000 (22:33 +0300)]
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.

12 years agoAdd parens, per compiler warning's suggestion.
Heikki Linnakangas [Thu, 18 Apr 2013 19:33:11 +0000 (22:33 +0300)]
Add parens, per compiler warning's suggestion.

12 years agoSilence warning about losing const in "const char *" to "char *" assignment.
Heikki Linnakangas [Thu, 18 Apr 2013 19:32:59 +0000 (22:32 +0300)]
Silence warning about losing const in "const char *" to "char *" assignment.