psqlodbc.git
11 years agoAdd more test cases for ODBC catalog functions.
Heikki Linnakangas [Tue, 18 Mar 2014 19:35:29 +0000 (21:35 +0200)]
Add more test cases for ODBC catalog functions.

Michael Paquier

11 years agoAdd test/Makefile to .gitignore.
Heikki Linnakangas [Tue, 18 Mar 2014 07:03:38 +0000 (09:03 +0200)]
Add test/Makefile to .gitignore.

It's generated from test/Makefile.in now.

11 years agoUse the PG_CONFIG setting from ./configure cmd line in regression tests.
Heikki Linnakangas [Mon, 17 Mar 2014 13:50:11 +0000 (15:50 +0200)]
Use the PG_CONFIG setting from ./configure cmd line in regression tests.

If compiling without libpq (configure --without-libpq), then you still need
to have pg_config in path to build the regression tests, or specify
PG_CONFIG at the make command line.

11 years agoReplace NOT_USE_LIBPQ with USE_LIBPQ #define.
Heikki Linnakangas [Mon, 17 Mar 2014 13:38:15 +0000 (15:38 +0200)]
Replace NOT_USE_LIBPQ with USE_LIBPQ #define.

This avoids the cumbersome double-negatives, "#ifndef NOT_USE_LIBPQ",
making the code easier to read.

11 years agoUse the same CFLAGS/LDFLAGS to build regression tests as used to build driver.
Heikki Linnakangas [Mon, 17 Mar 2014 08:31:02 +0000 (10:31 +0200)]
Use the same CFLAGS/LDFLAGS to build regression tests as used to build driver.

11 years agoAdd missing function declarations.
Heikki Linnakangas [Wed, 12 Mar 2014 07:40:21 +0000 (09:40 +0200)]
Add missing function declarations.

These are not actually used outside of pgtypes.c, but let's be consistent
and declare them in pgtypes.h anyway.

Michael Paquier

11 years agoUse "function(void)" instead of "function()" to declare 0-arg functions.
Heikki Linnakangas [Wed, 12 Mar 2014 07:24:14 +0000 (09:24 +0200)]
Use "function(void)" instead of "function()" to declare 0-arg functions.

"function(void)" is the correct syntax in a function declaration, although
in practice compilers accept the latter too. It's OK in a function
definition, but change those too for consistency.

Michael Paquier and me.

11 years agoRemove a couple of unused functions, and fix a typeo.
Heikki Linnakangas [Tue, 11 Mar 2014 11:28:14 +0000 (13:28 +0200)]
Remove a couple of unused functions, and fix a typeo.

11 years agoMore whitespace cleanup.
Heikki Linnakangas [Tue, 11 Mar 2014 11:15:55 +0000 (13:15 +0200)]
More whitespace cleanup.

Make whitespace and indentation more consistent in SQL_API function
declarations.

11 years agoWhitespace and indentation fixes.
Heikki Linnakangas [Tue, 11 Mar 2014 08:47:05 +0000 (10:47 +0200)]
Whitespace and indentation fixes.

This also changed the file permissions stored in git for a couple of header
files, removing the executable bit. Didn't realize they were different from
all the others, but apparently my editor decided to change them. Now
they're the same as all the other files, which seems good.

Michael Paquier and me.

11 years agoPass the argument to isalpha/isspace etc. routines as unsigned char.
Heikki Linnakangas [Mon, 10 Mar 2014 17:44:34 +0000 (19:44 +0200)]
Pass the argument to isalpha/isspace etc. routines as unsigned char.

Per the C standard, the routine should be passed an int, with a value that's
representable as an unsigned char or EOF. Passing a signed char is wrong,
because a negative value is not representable as an unsigned char.
Unfortunately no compiler warns about that.

11 years agoFix implicit casts between SQLCHAR and char. Don't rely on -Wno-pointer-sign.
Heikki Linnakangas [Mon, 10 Mar 2014 17:44:30 +0000 (19:44 +0200)]
Fix implicit casts between SQLCHAR and char. Don't rely on -Wno-pointer-sign.

11 years agoPrep release 09.03.0210. REL-09_03_0210
Hiroshi Saito [Thu, 6 Mar 2014 14:06:54 +0000 (23:06 +0900)]
Prep release 09.03.0210.

11 years agoAdd a .gitignore file to ignore test/results dir.
Heikki Linnakangas [Thu, 6 Mar 2014 11:45:24 +0000 (13:45 +0200)]
Add a .gitignore file to ignore test/results dir.

Michael Paquier

11 years agoUse "exit(1);" instead of "return;" to exit from main().
Heikki Linnakangas [Thu, 6 Mar 2014 11:45:21 +0000 (13:45 +0200)]
Use "exit(1);" instead of "return;" to exit from main().

Per Michael Paquier, at least some compiler on OS X didn't like it.

11 years agoRemove some dead code.
Heikki Linnakangas [Thu, 6 Mar 2014 11:45:17 +0000 (13:45 +0200)]
Remove some dead code.

11 years agoPass the content of POSTGRES_RESOURCE_VERSION variable to the resource
Hiroshi Inoue [Wed, 5 Mar 2014 08:00:45 +0000 (17:00 +0900)]
Pass the content of POSTGRES_RESOURCE_VERSION variable to the resource
compiler correctly so that FileVersion and ProductVersion are properly set.

11 years agoSilence another compiler warning.
Heikki Linnakangas [Mon, 3 Mar 2014 19:43:54 +0000 (21:43 +0200)]
Silence another compiler warning.

conn_settings cannot be NULL here.

11 years agoSilence compiler warning.
Heikki Linnakangas [Mon, 3 Mar 2014 19:23:06 +0000 (21:23 +0200)]
Silence compiler warning.

Michael Paquier

11 years agoRecord the result of Build in configuration.xml.
Hiroshi Inoue [Fri, 28 Feb 2014 14:01:37 +0000 (23:01 +0900)]
Record the result of Build in configuration.xml.

11 years agoIt's preferable to leave PRODUCTCODE history.
Hiroshi Inoue [Wed, 26 Feb 2014 06:17:36 +0000 (15:17 +0900)]
It's preferable to leave PRODUCTCODE history.

11 years agoAdd test case for CTE queries (WITH ...)
Heikki Linnakangas [Fri, 28 Feb 2014 08:47:41 +0000 (10:47 +0200)]
Add test case for CTE queries (WITH ...)

Tests for the bug fixed by commit b547553233b52fa5a84c24801c468530d8dd9a18.
None of the existing test cases covered that, so seems good to add one. This
test case gives a different error message than the original one, but it's
the same underlying issue.

11 years agoFix encoding of release-7.3.html
Heikki Linnakangas [Mon, 24 Feb 2014 14:25:39 +0000 (16:25 +0200)]
Fix encoding of release-7.3.html

The Content-type meta tag claimed it to be US-ASCII, but there was in fact
one non-ASCII character in there. Change the claimed encoding to UTF-8, and
fix the special character to the right byte sequence in UTF-8.

11 years agoConvert line-endings from CT+LF to LF.
Heikki Linnakangas [Mon, 24 Feb 2014 14:14:49 +0000 (16:14 +0200)]
Convert line-endings from CT+LF to LF.

All the other files were using LF, so let's be consistent.

11 years agoFix locking in SC_set_prepared
Heikki Linnakangas [Mon, 24 Feb 2014 13:44:50 +0000 (15:44 +0200)]
Fix locking in SC_set_prepared

Commit 2f4f8eabf6ce685c38d69da3e98132b77d38d188 added ENTER/LEAVE_CRIT_CS
calls in SC_set_prepared, as a belt-and-suspenders fix for the race condition
already fixed by commit 7065a7af196bb09f80beddce82fa728c8a6dfcba. But it
didn't take a NULL connection into account.

11 years agoUpdate EXTRA_DIST in Makefile.am
Heikki Linnakangas [Mon, 24 Feb 2014 13:28:19 +0000 (15:28 +0200)]
Update EXTRA_DIST in Makefile.am

Files for the new lfconversion test case were missing. Also, move bindcol
in the right place to keep the list in alphabetical order.

11 years agoSSL verify[-(ca|full)] is avaiable since 8.4. There seems no need to
Hiroshi Inoue [Sun, 23 Feb 2014 06:25:25 +0000 (15:25 +0900)]
SSL verify[-(ca|full)] is avaiable since 8.4. There seems no need to
check it. Also there's no need to call lt_dlopen currently.

11 years agoCurrently PQConnectdbParams() not yet used anyway.
Hiroshi Inoue [Sun, 23 Feb 2014 04:33:32 +0000 (13:33 +0900)]
Currently PQConnectdbParams() not yet used anyway.

11 years agochange version number. REL-09_03_0200
Hiroshi Saito [Sun, 23 Feb 2014 04:47:17 +0000 (13:47 +0900)]
change version number.

11 years agochange version number.
Hiroshi Saito [Sun, 23 Feb 2014 04:30:34 +0000 (13:30 +0900)]
change version number.

11 years agochange version number.
Hiroshi Saito [Sun, 23 Feb 2014 04:19:57 +0000 (13:19 +0900)]
change version number.

11 years agoOoops missing change.
Hiroshi Saito [Sun, 23 Feb 2014 00:28:51 +0000 (09:28 +0900)]
Ooops missing change.

11 years agoForget win_md5.c.
Hiroshi Saito [Sun, 23 Feb 2014 00:15:24 +0000 (09:15 +0900)]
Forget win_md5.c.

11 years agoPrep release ver 09.03.0200.
Hiroshi Saito [Sat, 22 Feb 2014 14:42:47 +0000 (23:42 +0900)]
Prep release ver 09.03.0200.

11 years agoPrep release ver 09.03.0200.
Hiroshi Saito [Sat, 22 Feb 2014 14:39:43 +0000 (23:39 +0900)]
Prep release ver 09.03.0200.

11 years agoAdditional modules, and etc.
Hiroshi Saito [Sat, 22 Feb 2014 13:45:45 +0000 (22:45 +0900)]
Additional modules, and etc.

11 years agowinresrc.h instead of winres.h.
Hiroshi Inoue [Sat, 22 Feb 2014 13:25:10 +0000 (22:25 +0900)]
winresrc.h instead of winres.h.

11 years agoChange to supply non-NULL parameters for SC_set_error().
Hiroshi Inoue [Sat, 22 Feb 2014 13:15:55 +0000 (22:15 +0900)]
Change to supply non-NULL parameters for SC_set_error().

11 years agoIt's safe to lock SC_set_prepared() itself.
Hiroshi Inoue [Sat, 22 Feb 2014 03:49:02 +0000 (12:49 +0900)]
It's safe to lock SC_set_prepared() itself.

11 years agoThe next release allows minor version up from 09.03.0100.
Hiroshi Inoue [Sat, 22 Feb 2014 03:45:48 +0000 (12:45 +0900)]
The next release allows minor version up from 09.03.0100.

11 years agoFix compilation errors caused by the commit 3116f70ab51d0218ceff241fd1323f436bb4fd60.
Hiroshi Inoue [Thu, 20 Feb 2014 15:08:40 +0000 (00:08 +0900)]
Fix compilation errors caused by the commit 3116f70ab51d0218ceff241fd1323f436bb4fd60.

11 years agoThe 2dn argument of SC_set_prepared() is int(enum) not BOOL.
Hiroshi Inoue [Thu, 20 Feb 2014 14:28:28 +0000 (23:28 +0900)]
The 2dn argument of SC_set_prepared() is int(enum) not BOOL.

11 years agoFix the judgement condition of minor or major upgrade.
Hiroshi Inoue [Tue, 4 Feb 2014 12:59:09 +0000 (21:59 +0900)]
Fix the judgement condition of minor or major upgrade.

11 years agoAdd locking to SQLFreeStmt and SQLFreeHandle.
Heikki Linnakangas [Thu, 20 Feb 2014 07:09:47 +0000 (09:09 +0200)]
Add locking to SQLFreeStmt and SQLFreeHandle.

This fixes a race condition, where SQLFreeStmt is called while the
connection is busy executing another statement. SC_set_prepared would see
that the connection is busy (CONN_EXECUTING), and not issue a DEALLOCATE
statement to free the prepared statement in the backend, leaking it.

11 years agoRefactor utf8_to_ucs_lf.
Heikki Linnakangas [Thu, 20 Feb 2014 07:05:58 +0000 (09:05 +0200)]
Refactor utf8_to_ucs_lf.

A macro is difficult to debug, so turn it into a regular function.

Also, add a new test case for LF->CR+LF conversion, to test the bug that
Nils Gösche reported (which was already fixed).

11 years agoRevert "When LF->CR+LF conversion causes an buffer truncation, supress the conversion...
Hiroshi Inoue [Wed, 19 Feb 2014 12:50:41 +0000 (21:50 +0900)]
Revert "When LF->CR+LF conversion causes an buffer truncation, supress the conversion (in case of unicode)."
This reverts commit 3666c87c1440862bde2e6b8f43ee585deed70d31.

11 years agoThe driver takes SQL_C_LONG to mean SQLINTEGER rather than "long".
Heikki Linnakangas [Fri, 14 Feb 2014 12:52:16 +0000 (14:52 +0200)]
The driver takes SQL_C_LONG to mean SQLINTEGER rather than "long".

The regression test was failing on the s390x architecture because of that.
It's big-endian, with sizeof(long) == 8.

11 years agoAdd regression test for SQLBindCol.
Heikki Linnakangas [Fri, 14 Feb 2014 12:24:13 +0000 (14:24 +0200)]
Add regression test for SQLBindCol.

We were already doing SQLBindCol as part of the positioned-update test, but
seems good to have one explicitly for it.

11 years agoFix cursors test case on big-endian systems.
Heikki Linnakangas [Thu, 13 Feb 2014 20:30:44 +0000 (22:30 +0200)]
Fix cursors test case on big-endian systems.

The SQL_CURSOR_COMMIT_BEHAVIOR property is a SQLUSMALLINT, not SQLUINTEGER.
On a little-endian system, you wouldn't notice, provided that the target
variable was initialized to 0 before the SQLGetInfo call.

Per report from Christoph Berg that the cursors test was failing on mipsel
and other big-endian architectures.

11 years agoMSBuild instead of nmake to build binaries using 10.0 or later version of VC.
Hiroshi Inoue [Mon, 3 Feb 2014 04:59:32 +0000 (13:59 +0900)]
MSBuild instead of nmake to build binaries using 10.0 or later version of VC.
See readme_winbuild.txt or winbuild/readme.txt about the use.

11 years agoSet TCP keepalive by default.
Hiroshi Inoue [Tue, 14 Jan 2014 10:54:28 +0000 (19:54 +0900)]
Set TCP keepalive by default.

11 years agoFix out-of-bounds write when Bind request packet size is a multiple of 4096.
Heikki Linnakangas [Thu, 9 Jan 2014 22:31:01 +0000 (00:31 +0200)]
Fix out-of-bounds write when Bind request packet size is a multiple of 4096.

Also add a test case to reproduce that bug on unpatched version.

Report and analysis by Patrice Dardoize.

11 years agoFix off-by-one error in parsing ExtraSysTablePrefixes and table types.
Heikki Linnakangas [Tue, 7 Jan 2014 14:00:48 +0000 (16:00 +0200)]
Fix off-by-one error in parsing ExtraSysTablePrefixes and table types.

I fixed these already once, but it was still off-by-one. Since we've been
burned by this twice now, refactor the code to make it more readable. Also
add a regression test case for the table types. The prefixes code is more
difficult to test since it's only used when connected to a pre-7.3 server.

Per report from Pavel Raiskup with help from Coverity static code analyzer.

11 years agoRemember "Description" DSN attribute
Heikki Linnakangas [Mon, 6 Jan 2014 09:23:54 +0000 (11:23 +0200)]
Remember "Description" DSN attribute

DSN attribute "Description" was not being copied from the input during DSN
creation in ConfigDSN(). This attribute is now copied into connection info
struct (while parsing input attributes) so that it is later saved (either in
File DSN or user/system DSN entry in Windows registry).

Patch and diagnosis by Nikhil Deshpande

11 years agoUpdate link to MSDN appendix on ODCB scalar functions.
Heikki Linnakangas [Fri, 20 Dec 2013 19:48:24 +0000 (21:48 +0200)]
Update link to MSDN appendix on ODCB scalar functions.

Mike Landl

11 years agoUpdate GUI to edit configuration.xml. REL-09_03_0100
Hiroshi Inoue [Wed, 18 Dec 2013 12:36:22 +0000 (21:36 +0900)]
Update GUI to edit configuration.xml.
Added items corrsponding to setvcvars elements.

11 years agoThe environment variable env:ProgramFiles(x86) in PowerShell must be enbraced.
Hiroshi Inoue [Wed, 18 Dec 2013 01:42:31 +0000 (10:42 +0900)]
The environment variable env:ProgramFiles(x86) in PowerShell must be enbraced.

11 years agoThe value x64 for PROCESSOR_ARCHITECTURE on Windows is unappropriate.
Hiroshi Inoue [Wed, 18 Dec 2013 01:19:05 +0000 (10:19 +0900)]
The value x64 for PROCESSOR_ARCHITECTURE on Windows is unappropriate.

11 years agoincrement of build number.
Hiroshi Saito [Tue, 17 Dec 2013 14:22:01 +0000 (23:22 +0900)]
increment of build number.

11 years agoFixed some typo.
Hiroshi Saito [Tue, 17 Dec 2013 14:20:56 +0000 (23:20 +0900)]
Fixed some typo.

11 years agoadjustment of the path name.
Hiroshi Saito [Mon, 16 Dec 2013 14:39:01 +0000 (23:39 +0900)]
adjustment of the path name.

11 years agochange name libintl.dll.
Hiroshi Saito [Mon, 16 Dec 2013 14:34:19 +0000 (23:34 +0900)]
change name libintl.dll.

11 years agoForget connexp.h.
Hiroshi Saito [Mon, 16 Dec 2013 14:28:38 +0000 (23:28 +0900)]
Forget connexp.h.

11 years agoincrement of build number.
Hiroshi Saito [Mon, 16 Dec 2013 13:13:52 +0000 (22:13 +0900)]
increment of build number.

11 years agoStop using inet_pton() when it's unavailable on Windows.
Hiroshi Inoue [Mon, 16 Dec 2013 08:03:16 +0000 (17:03 +0900)]
Stop using inet_pton() when it's unavailable on Windows.

11 years agoSuppress Windows Compile warnings: C4018 signed/unsigned mismatch by default.
Hiroshi Inoue [Mon, 16 Dec 2013 03:25:27 +0000 (12:25 +0900)]
Suppress Windows Compile warnings: C4018 signed/unsigned mismatch by default.

11 years agoForget modification.
Hiroshi Saito [Sun, 15 Dec 2013 13:32:32 +0000 (22:32 +0900)]
Forget modification.

11 years ago/bin/sh of standard equipment.
Hiroshi Saito [Sun, 15 Dec 2013 08:30:47 +0000 (17:30 +0900)]
/bin/sh of standard equipment.
problem in an environment of /usr/local/bin/bash.

11 years agoOoops, test makefile (not gmake) is broken.
Hiroshi Saito [Sun, 15 Dec 2013 06:35:08 +0000 (15:35 +0900)]
Ooops, test makefile (not gmake) is broken.

11 years agoFix the bug introduced by
Hiroshi Inoue [Sun, 15 Dec 2013 05:30:37 +0000 (14:30 +0900)]
Fix the bug introduced by
  commit d293c1bfbab69660683b07fd1fe3e0cc3cad570e
    Replace calls to my_strcat and my_strcat with snprintf_add.

Note that my_strcat1() does nothing when the 4th parameter doesn't
have a valid value.

11 years agofixed build error in WiX v3.8.
Hiroshi Saito [Sun, 15 Dec 2013 03:10:14 +0000 (12:10 +0900)]
fixed build error in WiX v3.8.
Per report ljwilson@digitalav.com.

11 years agoFixed not recognized by FreeBSD.
Hiroshi Saito [Sun, 15 Dec 2013 03:05:54 +0000 (12:05 +0900)]
Fixed not recognized by FreeBSD.

11 years agoPrep release 09.03.0100.
Hiroshi Saito [Sat, 14 Dec 2013 13:49:40 +0000 (22:49 +0900)]
Prep release 09.03.0100.

11 years agoAdding a split document.
Hiroshi Saito [Sat, 14 Dec 2013 13:37:00 +0000 (22:37 +0900)]
Adding a split document.

11 years agoArrangement change history.
Hiroshi Saito [Sat, 14 Dec 2013 13:09:11 +0000 (22:09 +0900)]
Arrangement change history.

11 years agoadd some contents and adjustment.
Hiroshi Saito [Fri, 13 Dec 2013 14:49:49 +0000 (23:49 +0900)]
add some contents and adjustment.
Per report Pavel Raiskup.

11 years agochange history(prep release)
Hiroshi Saito [Thu, 12 Dec 2013 12:34:02 +0000 (21:34 +0900)]
change history(prep release)

11 years agoCall getaddrinfo() with AI_NUMERICSERV because the service is a port number.
Hiroshi Inoue [Wed, 11 Dec 2013 11:50:02 +0000 (20:50 +0900)]
Call getaddrinfo() with AI_NUMERICSERV because the service is a port number.

11 years agosocket: speedup also ipv6 connection
Pavel Raiskup [Thu, 5 Dec 2013 12:58:30 +0000 (13:58 +0100)]
socket: speedup also ipv6 connection

[Patch by Pavel Raiskup]
Call getaddrinfo() with AI_NUMERICHOST if it is ipv4/ipv6 address.
For that reason the inet_pton() is better than inet_addr().

11 years agoFix memset() call, meant to clear the whole struct.
Heikki Linnakangas [Tue, 10 Dec 2013 09:16:16 +0000 (11:16 +0200)]
Fix memset() call, meant to clear the whole struct.

Per compiler warning.

11 years agoMake it possible to invoke several scripts from any working directory.
Hiroshi Inoue [Fri, 22 Nov 2013 07:15:56 +0000 (16:15 +0900)]
Make it possible to invoke several scripts from any working directory.

11 years agoStop dot-sourcing a script to avoid confusion of scope of variables. Also make it...
Hiroshi Inoue [Thu, 21 Nov 2013 05:19:17 +0000 (14:19 +0900)]
Stop dot-sourcing a script to avoid confusion of scope of variables. Also make it possible to specify the configuration file path as a parameter.

11 years agoAdd formatVersion attribute to configuration.xml so as to detect the format change...
Hiroshi Inoue [Thu, 21 Nov 2013 00:08:47 +0000 (09:08 +0900)]
Add formatVersion attribute to configuration.xml so as to detect the format change. Unify configuration_template.xml to configuration.xml when the format change is detected.

11 years agoRemove CRs from editConfiguration.ps1.
Hiroshi Inoue [Thu, 21 Nov 2013 07:55:50 +0000 (16:55 +0900)]
Remove CRs from editConfiguration.ps1.

11 years agobufferoverflowu.lib seems no longer needed in recent versions of VC environment.
Hiroshi Inoue [Mon, 18 Nov 2013 12:55:18 +0000 (21:55 +0900)]
bufferoverflowu.lib seems no longer needed in recent versions of VC environment.
 So removed it from win64.mak. Speocify CUSTOMLINKLIBS=bufferoverflowu.lib from the command line when it is neccessary in old VC environment.

11 years agoAdd build_macros element to winbuild/configuration(_template).xml so that buildXxx...
Hiroshi Inoue [Sun, 17 Nov 2013 03:34:40 +0000 (12:34 +0900)]
Add build_macros element to winbuild/configuration(_template).xml so that buildXxx.ps1 can specify macros to the makefiles. Also make some part of CL options of makefiles replacable.

11 years agoMove -Wall -Wno-pointer-sign CFLAGS option specified in Makefile.am to configure...
Hiroshi Inoue [Fri, 15 Nov 2013 02:47:33 +0000 (11:47 +0900)]
Move -Wall -Wno-pointer-sign CFLAGS option specified in Makefile.am to configure.ac. Users can disable those options by giving CFLAGS option explicitly. Also verify the availability of those options.

11 years agoStop linking lib(i)odbc library because the library is unnecessary and rather harmful...
Hiroshi Inoue [Thu, 14 Nov 2013 01:58:01 +0000 (10:58 +0900)]
Stop linking lib(i)odbc library because the library is unnecessary and rather harmful. Per report from Pavel Raiskup(postgresql.org/message-id/1769926.65KUyECjFr@nb.usersys.redhat.com).

11 years agoUse snprintf() instead of sprintf() for safety.
Heikki Linnakangas [Tue, 12 Nov 2013 23:23:57 +0000 (01:23 +0200)]
Use snprintf() instead of sprintf() for safety.

I believe these instances were in fact safe, because a cursor name has
a maximum length, but better safe than sorry.

11 years agoAdd regression test for SQLTables() function.
Heikki Linnakangas [Tue, 12 Nov 2013 22:59:01 +0000 (00:59 +0200)]
Add regression test for SQLTables() function.

11 years agoFix buffer overflow in handling of SQLTables params.
Heikki Linnakangas [Tue, 12 Nov 2013 22:56:15 +0000 (00:56 +0200)]
Fix buffer overflow in handling of SQLTables params.

Found by Fortify static analysis tool.

11 years agoReplace calls to my_strcat and my_strcat with snprintf_add.
Heikki Linnakangas [Tue, 12 Nov 2013 22:15:38 +0000 (00:15 +0200)]
Replace calls to my_strcat and my_strcat with snprintf_add.

my_strcat didn't check for buffer overflow, which Fortify static analysis
tool flagged as an issue. I'm not sure if that can actually happen, but
the code is clearer like this anyway.

11 years agoCheck return value of stdup() for out-of-memory.
Heikki Linnakangas [Tue, 12 Nov 2013 21:57:29 +0000 (23:57 +0200)]
Check return value of stdup() for out-of-memory.

There are a lot of little bugs like this throughout the code, but it's
start...

Flagged by Fortify static analysis tool.

11 years agoFix buffer overflow in interval parsing.
Heikki Linnakangas [Tue, 12 Nov 2013 21:53:04 +0000 (23:53 +0200)]
Fix buffer overflow in interval parsing.

Includes a test case.

Flagged by Fortify static analysis tool.

11 years agoConstruct ctid string correctly for block no > 2^31.
Heikki Linnakangas [Tue, 12 Nov 2013 20:35:56 +0000 (22:35 +0200)]
Construct ctid string correctly for block no > 2^31.

Block number is unsigned. Other places where we construct ctid strings we
got this right, but not this one. I'm not sure how to trigger this codepath,
but I'm sure something funny would happen if you tried to use these functions
on large enough tables (> 16 TB).

11 years agoEscape double-quotes in table name correctly.
Heikki Linnakangas [Tue, 12 Nov 2013 20:21:51 +0000 (22:21 +0200)]
Escape double-quotes in table name correctly.

When constructing the select/update/delete for current row in a rowset,
and the schema or table name contained double-quotes, they were not correctly
escaped in the constructed SQL statement. That lead to errors when doing
positioned updates.

Also, use snprintf and snprintf_add instead of sprintf and strcat in more
places. Makes these things look less like buffer overflows to static analysis
tools, and make for more readable code anyway.

11 years agoAdd test case for positioned updates (SQLSetPos).
Heikki Linnakangas [Tue, 12 Nov 2013 18:19:06 +0000 (20:19 +0200)]
Add test case for positioned updates (SQLSetPos).

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.