Hiroshi Inoue [Tue, 4 Jul 2017 21:04:41 +0000 (06:04 +0900)]
Fix some compiler warnings.
Michael Paquier [Mon, 3 Jul 2017 22:26:18 +0000 (07:26 +0900)]
Add support for foreign tables and matviews in SQLTables
Regression tests are added in consequence.
Hiroshi Inoue [Sun, 18 Jun 2017 10:09:45 +0000 (19:09 +0900)]
Review CC_send_query_append(.., .., ROLLBACK_ON_ERROR | IGNORE_ABORT_ON_CONN, .., ..).
[in the multiple command]
SAVEPOINT xxxxx;exec something;REALEASExxxxx
1. Discard the result and the effect of RELEASE as well as of SAVEPOINT.
2. Suppress CC_on_abort_partial() calls.
3. For an error resetting command 'ROLLBACK to xxxxx;RELEASE xxxxx', call PQsendQuery() instead of PQexec().
Hiroshi Inoue [Sun, 25 Jun 2017 04:48:35 +0000 (13:48 +0900)]
Review the use of PG_ErrorInfo.
1. Remove PGAPI_Error() because it is no longer used.
2. The switch PODBC_ERROR_CLEAR for the last parameter of ER_ReturnError() is no longer needed and the 1st parameter was changed from PG_ErrorInfo ** to PG_ErrorInfo *.
3. The __error_message member of PG_ErrorInfo was changed to [1] to [40] in order to handle STMT_NO_MEMORY_ERROR.
Hiroshi Inoue [Thu, 22 Jun 2017 03:55:55 +0000 (12:55 +0900)]
Review the error handling in libpq_bind_and_exec().
1. Set the errornumber STMT_NO_MEMORY_ERROR if necessary.
2. There's a code which can forget QueryResults without calling QR_Destructor().
Hiroshi Inoue [Thu, 22 Jun 2017 21:33:05 +0000 (06:33 +0900)]
Fix the bug reported by Keith Handlon.
Skip malloc(0) in build_libpq_bind_params(). malloc(0) seems to return NULL on AIX, whereas it returns non-NULL on Windows or linux.
Hiroshi Inoue [Mon, 19 Jun 2017 20:38:14 +0000 (05:38 +0900)]
Fix an infinite loop of CC_on_commit. The loop occurs when checking whether cursors are alive using 'MOVE 0' in CC_clear_cursors().
Hiroshi Inoue [Sun, 18 Jun 2017 12:47:29 +0000 (21:47 +0900)]
Don't call CC_send_query() so as to ROLLBACK to the internal savepoint.
Also remove the flag ROLLBACK_IN_PROGRESS. It was misued and is no longer needed.
Hiroshi Inoue [Sat, 17 Jun 2017 03:15:28 +0000 (12:15 +0900)]
Reduce roundtrips when using SAVEPOINTs by issuing multiple commands after prepending (RELEASE xxxx;)SAVEPOINT; to simple queries.
Unfortunately it's impossible to recover syntax errors after this change.
Hiroshi Inoue [Thu, 15 Jun 2017 03:44:39 +0000 (12:44 +0900)]
Mark some queries as read-only in addition to the previous commit.
Hiroshi Inoue [Mon, 12 Jun 2017 12:09:20 +0000 (21:09 +0900)]
Reduce SAVEPOINT calls especially in use declare/fetch mode by omitting SAVEPOINT calls after read-only statements(queries).
Note that DECLARE command is not thought to be read-only because the cursor disappears when rolled back to a savepoint established before the DECLARE command.
Hiroshi Inoue [Fri, 9 Jun 2017 02:05:43 +0000 (11:05 +0900)]
Reduce the number of roundtrips in the implementation of statement rollack.
Change the current sequence of operations
SAVEPOINT -> execute -> RELEASE
to
(RELEASE;)SAVEPOINT -> execute
.
Note that there are 2 risks to RELEASE an internal savepoint. One is to RELEASE the savepoint invalitated due to manually issued ROLLBACK or RELEASE. Another is to invalitate manual SAVEPOINTs unexpectedly by RELEASing the internal savepoint.
Currently *RELEASE* related stuff is #ifdef'd.
Hiroshi Inoue [Sat, 10 Jun 2017 05:47:21 +0000 (14:47 +0900)]
Clean up the use of 'internal' member of StatementClass.
Give up to roll back 'internal' statements because the functionality is not effectively used.
Introduced 'external' instead of 'internal'.
Hiroshi Inoue [Wed, 7 Jun 2017 09:26:17 +0000 (18:26 +0900)]
Rename snprintf_add() snprintfcat().
Use SPRINTF_FIXED() or SPRINTFCAT_FIXED() where they are available.
Hiroshi Inoue [Wed, 7 Jun 2017 11:38:07 +0000 (20:38 +0900)]
Avoid a confusing use of snpritf().
Hiroshi Inoue [Tue, 6 Jun 2017 09:25:36 +0000 (18:25 +0900)]
With GCC, we can check at compilation time whether the first parameter of xxxxx_FIXED() macros is not a pointer. Fixed some inappropriate use of STRCPY_FIXED().
Hiroshi Inoue [Mon, 5 Jun 2017 11:52:41 +0000 (20:52 +0900)]
Clean up the use of sprintf(). Replace sprintf() by snprintf() or the macro SPRINTF_FIXED().
Hiroshi Inoue [Mon, 5 Jun 2017 06:52:21 +0000 (15:52 +0900)]
Clean up the use of strcat(). Replace strcat() by strlcat() or the macro STRCAT_FIXED().
Hiroshi Inoue [Sun, 1 May 2016 11:58:09 +0000 (20:58 +0900)]
For debug, change SQLSetConnectAttr(.., SQL_ATTR_PGOPT_USE_DECLAREFETCH, ..) so that it also updates updatable_cursors member of Connnfo.
Hiroshi Inoue [Mon, 5 Jun 2017 05:11:13 +0000 (14:11 +0900)]
Modify cursor-block-delete-test so that the test runs without the specification of UseDeclareFetch option.
Also change the cursor type from SQL_CURSOR_STATIC to SQL_CURSOR_KEYSET_DRIVEN though the type is changed to SQL_CURSOR_STATIC with UseDeclareFetch option.
Hiroshi Inoue [Sat, 3 Jun 2017 12:42:52 +0000 (21:42 +0900)]
Cleanup the code by replacing strcpy() by strncpy_null(), strlcat() or snprintf_add().
Hiroshi Inoue [Sun, 4 Jun 2017 10:37:25 +0000 (19:37 +0900)]
Fix a crash bug in SQLBulkOperations() under use_declare/fetch off mode.
Hiroshi Inoue [Sun, 4 Jun 2017 04:53:34 +0000 (13:53 +0900)]
Visual C++ 14 provides snprintf().
Hiroshi Inoue [Fri, 2 Jun 2017 23:28:54 +0000 (08:28 +0900)]
Change XAConnection so that it properly disconnect from the connection.
Hiroshi Inoue [Thu, 1 Jun 2017 08:45:07 +0000 (17:45 +0900)]
Add or change some mylog messages for debugging.
Hiroshi Inoue [Mon, 29 May 2017 02:48:43 +0000 (11:48 +0900)]
Remove the use of strcpy() in dlg_specific.c. Instead use strncpy_null() or a macro STRCPY_FIXED().
Hiroshi Inoue [Wed, 31 May 2017 23:10:41 +0000 (08:10 +0900)]
In xa_recover() invoked from MSDTC, the occurence of authentication error is unrecoverable.
It seems better to return 0 rather than return error.
Hiroshi Inoue [Wed, 31 May 2017 07:49:33 +0000 (16:49 +0900)]
Rename "OK" button in Global settings dialog to "Save" button because the button updates the registry.
Hiroshi Inoue [Wed, 31 May 2017 06:13:18 +0000 (15:13 +0900)]
In psqlodbc ODBC Driver Setup dialog, reflect the updates of the initial dialog to other dialogs.
Hiroshi Inoue [Wed, 31 May 2017 01:48:32 +0000 (10:48 +0900)]
Display MSDTC error messages properly in Distributed Transaction related settings test.
Hiroshi Inoue [Tue, 30 May 2017 11:33:50 +0000 (20:33 +0900)]
Fix a crash when testing Distributed Transaction related settings.
Hiroshi Inoue [Mon, 29 May 2017 06:27:53 +0000 (15:27 +0900)]
Add missing declaration.
Hiroshi Inoue [Mon, 29 May 2017 02:54:15 +0000 (11:54 +0900)]
Fix a bug in makeConnectString().
Hiroshi Inoue [Sun, 28 May 2017 07:54:23 +0000 (16:54 +0900)]
Modify getDSNinfo(). There should be no change in ConnInfo unless a corresponding ODBC.INI entry exists.
Hiroshi Inoue [Sat, 27 May 2017 12:18:06 +0000 (21:18 +0900)]
Unify copyAttributes() and copyCommonAttributes() into copyConnAttributes().
Hiroshi Inoue [Wed, 24 May 2017 04:59:36 +0000 (13:59 +0900)]
Revise the update of ConnInfo using DSN and/or connection string.
Overwrite ConnInfo by driver's default -> Dsn entry -> connection string in order.
As a result, remove getDSndefaults() and the second parameter(overwrite) of getDSNinfo().
Hiroshi Inoue [Fri, 26 May 2017 09:24:38 +0000 (18:24 +0900)]
Review the conditions to display dialogs in SQLDriverConnect().
Hiroshi Inoue [Thu, 25 May 2017 03:51:52 +0000 (12:51 +0900)]
Recover the code in SQLGetDiagRecW() and SQLGetDiagFieldW() commented out by the commit
be22502.
Hiroshi Inoue [Wed, 24 May 2017 02:13:40 +0000 (11:13 +0900)]
Remove ConnInfo.drivers.onlyread and ConnInfo.drivers.conn_settings.
They are rather confusing and we can use ConnInfo.onlyread and ConnInfo.conn_settings.
Hiroshi Inoue [Sat, 20 May 2017 05:04:48 +0000 (14:04 +0900)]
Removed an external variable "globals".
Also removed driver_optionsProc().
Use getDriverNameFromDSN() for unixODBC as well as Windows.
Hiroshi Inoue [Mon, 22 May 2017 10:47:08 +0000 (19:47 +0900)]
Remove unused variables.
Hiroshi Inoue [Tue, 16 May 2017 09:57:39 +0000 (18:57 +0900)]
Remove the stuff about Debug and Commlog from getCommonDefaults().
Now per connection Debug/Commlog info are handled in getDSNinfo().
Global Debug/Commlog info are get/set using functions get(set)GlobalDebug(Commlog)().
Hiroshi Inoue [Mon, 15 May 2017 11:32:56 +0000 (20:32 +0900)]
For the sake of clarity #define DBMS_NAME in psqlodbc.h instead of specifying MSBuild parameters.
Hiroshi Inoue [Tue, 9 May 2017 04:10:26 +0000 (13:10 +0900)]
Implement SC_get_localtime() and reduce time()/localtime() calls.
Hiroshi Inoue [Tue, 2 May 2017 11:30:15 +0000 (20:30 +0900)]
Make a function setup_getdataclass() separating from long confusing if-block in convert_text_field_to_sql_c() and clarify the parameters. Also move the stuff which hanldles GetDataClass into convert_text_field_to_sql_c().
Provide functions get_terminator_len() and get_adjust_len() which
hide #ifdef UNICODE_SUPPORT ~ #endif.
Hiroshi Inoue [Wed, 26 Apr 2017 02:10:14 +0000 (11:10 +0900)]
Reorganize the language conversion between the current locale and unicode.
Support the platforms e.g. FreeBSD which satisfies __STDC_UTF_16__ (but not satify __STDC_ISO_10646__) using mbrtoc16() and c16rtomb().
Use the functions bindpara_msg_to_utf8(), bindpara_wchar_to_msg(),
bindcol_hybrid_estimate(), bindcol_hybrid_exec(), bindcol_localize_estimate()
and bindcol_localize_exec() which hide the difference of platforms instead of
platform specific functions. They are implemented using already implemented
wstrtomsg(), msgtowstr(), wcs_to_utf8(), utf8_to_wcs_lf() and newly implemented
mbstoc16_lf(), c16tomsb(), ucs4_to_ucs2_lf(), ucs2_to_ucs4().
Add eucJP encoding case to wchar-char test.
[Minor changes]
Add conversion error check between unicode and the current locale.
Rename buf to send_buf in ResolveOneParam() so that grep or find can them find easily.
Separate "unicode_support.h" from "psqlodbc.h"
Change convert_linefeeds() from static to external.
Add AC_CHECK_FUNCS(mbrtoc16 c16rtomb) to Makefile.am.
Remove win_unicode.c from psqlsetup.vcxproj.
Hiroshi Saito [Thu, 11 May 2017 14:25:23 +0000 (23:25 +0900)]
Prep release 09.06.0310.
Hiroshi Inoue [Wed, 10 May 2017 08:06:16 +0000 (17:06 +0900)]
Fix a crash bug when connecting from MSACCESS(Microsoft Jet) reported by Robert Ball. This occurs when MSACCESS(Jet) calls SQLConnectAttr(.., 30002, ..) => ucs2_to_utf8() and about to call mylog() with a NULL derefernced pointer parameter.
Hiroshi Saito [Sun, 7 May 2017 14:05:59 +0000 (23:05 +0900)]
Prep release 09.06.0300.
Hiroshi Saito [Sat, 29 Apr 2017 12:39:42 +0000 (21:39 +0900)]
add bat files for windows.
Hiroshi Inoue [Thu, 27 Apr 2017 12:26:54 +0000 (21:26 +0900)]
Handle the case locale is 'C' in wchar-char-test.
Hiroshi Inoue [Thu, 27 Apr 2017 11:56:18 +0000 (20:56 +0900)]
Fix a crash bug when the locale isn't set.
Hiroshi Inoue [Thu, 27 Apr 2017 08:22:02 +0000 (17:22 +0900)]
exit(0) instead of exit(1).
Hiroshi Inoue [Thu, 27 Apr 2017 02:16:14 +0000 (11:16 +0900)]
Set lc_messages='C' for regression test.
Hiroshi Inoue [Wed, 26 Apr 2017 22:54:10 +0000 (07:54 +0900)]
Add fflush(stdout).
Hiroshi Inoue [Wed, 26 Apr 2017 08:37:21 +0000 (17:37 +0900)]
Fix a compiler warning.
Hiroshi Inoue [Wed, 26 Apr 2017 08:15:23 +0000 (17:15 +0900)]
Use the same CPPFLAGS as well as CFLAGS/LDFLAGS to build regression tests as used to build driver.
Also uchar.h header checking for later use.
Hiroshi Inoue [Wed, 19 Apr 2017 11:06:42 +0000 (20:06 +0900)]
Review the handling of OUTPUT parameters in SQLProcedureColumns().
1. If there are OUT, INOUT or TABLE arguments, ignore RETURN values.
2. OUT parameters of functions with returning SETOF should be treated as SQL_RESULT_COL rather than SQL_PARAM_OUTPUT.
3. Also treat table output arguments as SQL_RESULT_COL because functions returning table are equivalent to using one or more OUT parameters plus marking the function as returning SETOF record (or SETOF a single output parameter's type).
Also add 5 test cases about SQLProcedureColumns to catalogfunctions-test.
Hiroshi Inoue [Sun, 23 Apr 2017 09:32:26 +0000 (18:32 +0900)]
Modify a message a little.
Hiroshi Inoue [Sun, 23 Apr 2017 05:43:18 +0000 (14:43 +0900)]
Correct the inappropriate use of set_nullfield_int2().
Hiroshi Inoue [Wed, 19 Apr 2017 02:45:16 +0000 (11:45 +0900)]
Don't reset the status of Keyset in case of updates.
This fixes the bug about repeated updates using SQLSetPos().
positioned-update-test now passes.
Hiroshi Inoue [Fri, 21 Apr 2017 08:03:50 +0000 (17:03 +0900)]
Error out when SQLSetPos() skips updates.
Hiroshi Inoue [Thu, 20 Apr 2017 09:38:45 +0000 (18:38 +0900)]
Psqlodbc driver seems to skip repeated updates using SQLSetPos(.., SQL_UPDATE, ..). For the bug fix, modify positioned-update-test so that it includes repeated updates.
Hiroshi Inoue [Thu, 20 Apr 2017 04:19:12 +0000 (13:19 +0900)]
Fix a crash bug introduced by the previous commit.
Hiroshi Inoue [Sun, 22 Jan 2017 12:05:14 +0000 (21:05 +0900)]
Add an environment variable which defines a common connection string for regression test. Switch declare/fetch mode in Windows regression test using this functionality.
Hiroshi Inoue [Wed, 12 Apr 2017 00:09:51 +0000 (09:09 +0900)]
Add __STDC_ISO_10646__ check to confirm that wchar_t means unicode.
Hiroshi Inoue [Mon, 3 Apr 2017 12:48:57 +0000 (21:48 +0900)]
It's bad to use lf_conv here.
Hiroshi Inoue [Sun, 2 Apr 2017 04:43:43 +0000 (13:43 +0900)]
Rename the dsn for ANSI regression test from psqlodbc_test_dsna to psqlodbc_test_dsn_ansi.
Hiroshi Inoue [Wed, 29 Mar 2017 09:27:20 +0000 (18:27 +0900)]
Handle locales in non-Windows platforms and overhaule the language system.
Hiroshi Inoue [Fri, 31 Mar 2017 07:42:11 +0000 (16:42 +0900)]
Modify wchar-char test a little.
Hiroshi Inoue [Sun, 26 Mar 2017 11:59:24 +0000 (20:59 +0900)]
Add a new test case wchar-char-test.
Hiroshi Inoue [Mon, 27 Mar 2017 09:48:28 +0000 (18:48 +0900)]
Remove #ifdef WIN_UNICODE_SUPPORT.
Hiroshi Inoue [Fri, 24 Mar 2017 23:00:20 +0000 (08:00 +0900)]
Make a function convert_text_field_to_sql_c() simply extracting from long confusing code and clarify the parameters for subsequent modifications.
Hiroshi Inoue [Sat, 25 Mar 2017 08:12:26 +0000 (17:12 +0900)]
Introduce locale_encoding which corresponds to the locale. For non-Windows platforms determine the locale encodings from the current locale.
Hiroshi Inoue [Fri, 24 Mar 2017 02:30:58 +0000 (11:30 +0900)]
Add #ifdef UNICODE_SUPPORT where there should be.
Hiroshi Inoue [Fri, 24 Mar 2017 06:53:32 +0000 (15:53 +0900)]
Stop using percent-encoding to store the conn_settings option in odbc.ini.
Hiroshi Inoue [Fri, 24 Mar 2017 03:43:34 +0000 (12:43 +0900)]
For Unicode drivers, when SQLConnect() or SQLDriverConnect() instead of SQLConnectW or SQLDriverConnectW is called, use the same client encoding as ANSI version of drivers use.
Hiroshi Inoue [Thu, 23 Mar 2017 08:36:12 +0000 (17:36 +0900)]
Change the max byte per char of UTF8 from 6 to 4. This affects the result of ANSI colattribute-test.
Hiroshi Inoue [Thu, 23 Mar 2017 08:59:42 +0000 (17:59 +0900)]
Modify odbcini-gen.sh so that it generates ANSI driver and dsn as well.
Hiroshi Inoue [Wed, 22 Mar 2017 10:12:21 +0000 (19:12 +0900)]
Generate psqlodbca.so(ANSI version of driver) as well as psqlodbca.so at once.
Hiroshi Inoue [Wed, 22 Mar 2017 04:37:09 +0000 (13:37 +0900)]
Revise the handling of client encoding so as not to forget the update of related items(ccsc or mb_maxbyte_per_char).
Hiroshi Inoue [Tue, 21 Mar 2017 11:52:07 +0000 (20:52 +0900)]
Simple implementation of get_environment_setting() on non-Windows platforms.
If the codeset part of the current locale is UTF8, set the client_encoding to 'UTF8'.
Take * set client_coding='...' * into account in check_client_coding().
Hiroshi Inoue [Mon, 20 Mar 2017 12:06:04 +0000 (21:06 +0900)]
Fix ansi version result-conversions-test on Windows.
Hiroshi Inoue [Mon, 20 Mar 2017 22:57:54 +0000 (07:57 +0900)]
Reflect the ANSI test dsn to reset-db.
Hiroshi Inoue [Mon, 20 Mar 2017 12:40:02 +0000 (21:40 +0900)]
Fix a compilation error and remove an ununed varaible.
Hiroshi Inoue [Mon, 20 Mar 2017 10:05:42 +0000 (19:05 +0900)]
Fix a dangling reference in CC_lookup_characterset() introduced by the commit
e85fbb2.
Hiroshi Inoue [Sun, 19 Mar 2017 13:00:41 +0000 (22:00 +0900)]
The 1st cut to add regression test for Windows Ansi drivers.
Hiroshi Inoue [Mon, 20 Mar 2017 01:06:14 +0000 (10:06 +0900)]
Remove unnecessary code from Unicode drivers.
Hiroshi Inoue [Mon, 20 Mar 2017 00:26:00 +0000 (09:26 +0900)]
Fix a bug about Unicode driver for ansi apps.
Hiroshi Inoue [Sun, 19 Mar 2017 06:04:47 +0000 (15:04 +0900)]
Fixes about SQLDescribeCol() or SQLColAttribute().
1. Report the size of constant strings using Unknown Sizes as Longest.
2. Correct the inconsistency between the sqltype of PG_TYPE_TEXT or PG_TYPE_UNKNOWN and the size in case of Unknown Sizes as Longeset.
Hiroshi Inoue [Sat, 18 Mar 2017 23:12:40 +0000 (08:12 +0900)]
Remove obsolete code in statement.c.
Hiroshi Inoue [Sat, 18 Mar 2017 07:04:55 +0000 (16:04 +0900)]
Use symbols defined in catfunc.h instead of literal column numbers in SQLGetTypeInfo(), SQLSpecialColumns() and SQLTablePrivileges().
Hiroshi Inoue [Sat, 18 Mar 2017 05:11:03 +0000 (14:11 +0900)]
Remove UNKNOWNS_AS_CATALOG of Unknown Sizes option.
Also remove test case in colattribute-test corresponding to UNKNOWNS_AS_CATALOG.
Hiroshi Inoue [Sat, 18 Mar 2017 01:41:06 +0000 (10:41 +0900)]
Revise the use of pgtype_xxxx() in catalog functions.
Replace pgtype_xxxx() whose 1st parameter is StatementClass with pgtype_attr_xxxx(). Also use macros for pgtype_xxxx() calls which have PG_ATP_UNSET, PG_ADT_UNSET or PG_UNKNOWNS_UNSET parameters.
Remove the use of PG_STATIC and UNKNOWNS_AS_DEFAULT.
Remove the test case in colattribute-test corresponding to UNKNOWNS_AS_DEFAULT. The test case was meaningless in the first place.
Hiroshi Inoue [Fri, 17 Mar 2017 11:21:16 +0000 (20:21 +0900)]
Revise the handling of show oid column and row versioning option.
Hiroshi Inoue [Wed, 15 Mar 2017 07:17:03 +0000 (16:17 +0900)]
Modify the code about UNKNOWNS_AS_LONGEST of the Unknown Sizes option so that it works properly.
Hiroshi Inoue [Thu, 16 Mar 2017 09:44:08 +0000 (18:44 +0900)]
Remove obsolete code in pgtypes.c.
Hiroshi Inoue [Thu, 16 Mar 2017 02:13:17 +0000 (11:13 +0900)]
Remove obsolete code in info.c.
Hiroshi Inoue [Mon, 13 Mar 2017 11:47:27 +0000 (20:47 +0900)]
For debug, implement SQLSet/GetConnectAttr() for some driver specific options.
Hiroshi Saito [Fri, 10 Mar 2017 15:14:15 +0000 (00:14 +0900)]
Prep release 09.06.0200