Author: Tristan Daniel Date: Mon Nov 2 09:42:43 2026 +0100 ctlib: fix ct_results() hang on empty result set with CS_DYNAMIC_CMD When a prepared statement (CS_DYNAMIC_CMD) returns an empty result set, ct_results() returns a manufactured CS_ROW_RESULT and the subsequent ct_fetch() hangs indefinitely in tds_peek(). In 4fea9e7 ("fix ct-library rows count", 2016-04-30), CS_ROWFMT_RESULT was split from CS_COMPUTEFMT_RESULT into its own case, with an intentional fallthrough to CS_ROW_RESULT for non-cursor/non-dynamic commands. The CS_DYNAMIC_CMD check was added to break before the fallthrough. Later, 4a8e777 (2016-05-11) restructured the CS_ROWFMT_RESULT case, replacing the fallthrough with an explicit process_flags update that swaps TDS_RETURN_DONE for TDS_STOPAT_DONE. However, the CS_DYNAMIC_CMD early break was preserved, now causing it to skip the process_flags update instead of just skipping a fallthrough. Without TDS_STOPAT_DONE, ct_results() consumes the DONE token internally and returns a manufactured CS_ROW_RESULT. The caller then calls ct_fetch(), which calls tds_peek() to check the next token. Since the DONE token was already consumed and TDS state is IDLE, tds_peek() blocks forever on a socket read that will never produce data. With rows present, TDS_STOPAT_ROW (already set) catches row tokens before the DONE, so ct_fetch sees the DONE via tds_peek and returns CS_END_DATA. Only empty result sets trigger the hang. Take the TDS_STOPAT_DONE path for dynamic executes only: prepare responses may carry a row format (SQL Anywhere, MSSQL sp_prepare) but return no fetchable result, so stopping at their DONE would leave it unread and produce a spurious extra CS_CMD_SUCCEED/CS_CMD_DONE pair. Observed with SQL Anywhere 17.0.9 over TDS 5.0, whose empty execute response ends with a plain DONE token (ASE and MSSQL end with DONEINPROC/DONEPROC and do not hit this path). Merge: 4db0a7bb 036488ee Author: Frediano Ziglio Date: Sun Oct 25 18:00:57 2026 +0000 Merge fix for OpenSSL certificate check Author: Frediano Ziglio Date: Sun Oct 25 17:04:25 2026 +0000 odbc: Make query fail again Apparently now -100000 days from now is accepted by the server. The test requires the query to return error to succeed. Author: Frediano Ziglio Date: Sun Oct 25 16:31:26 2026 +0000 Fix certificate check for OpenSSL Code for OpenSSL hostname check was checking certificate name against hostname while the check should be hostname against certificate name. So the check failed in case of wildcards in the certificate. This fixes https://github.com/FreeTDS/freetds/issues/738. Author: Frediano Ziglio Date: Sat Aug 15 20:32:25 2026 +0100 tds: Prevent infinite loop when sending disconnect request For TDS 5 (Sybase) connections, a disconnect request is sent automatically during disconnect. If the request cannot be sent, the disconnect logic may retry the disconnect operation, causing another disconnect request to be sent. This can lead to an infinite loop of failed disconnect requests. Author: Frediano Ziglio Date: Fri May 15 22:38:43 2026 +0100 Fix compatibility with Nettle 4 library Hash length parameter was removed from digest functions like nettle_md4_digest and sha1_digest. Change similar to commit e2bf8f3a3e81f1aa94fd15fa206dd4ec5ddf2ec7 (cfr "utils: Fix compatibility with Nettle 4 library"). Author: Frediano Ziglio Date: Sat Apr 18 09:30:31 2026 +0100 odbc: Make SQLSetDescField extend automatically the descriptor This it's the correct behaviour for SQLSetDescField, not returning error if the record is missing. Author: Frediano Ziglio Date: Sun Mar 29 20:38:27 2026 +0100 odbc: Update SQLGetInfo(SQL_DESCRIBE_PARAMETER) SQLDescribeParam was implemented, so return it's supported. Author: Frediano Ziglio Date: Mon Mar 23 18:31:52 2026 +0000 odbc: Fix SQL_DESC_BIND_OFFSET_PTR handling Use sql_desc_bind_offset_ptr not only on structure binding or on following (not first) rows. SQLExtendedFetch uses sql_desc_bind_offset_ptr so do not clear it. Add a test, partially from Bob Kline. This fixes https://github.com/FreeTDS/freetds/issues/716. Author: Frediano Ziglio Date: Sat Feb 14 17:16:58 2026 +0000 utils: Fix compatibility with Nettle 4 library Hash length parameter was removed from nettle_md5_digest. Method suggested by Satadru Pramanik. Author: Frediano Ziglio Date: Thu Feb 19 04:48:16 2026 +0000 odbc: Fix leak in SQLDriverConnect if string is invalid Login structure was not freed if odbc_parse_connect_string returned false, which can simply happen if the string has an invalid syntax. Author: Frediano Ziglio Date: Mon Feb 16 21:45:25 2026 +0000 tds: Avoid overflow converting numeric to string Author: Aaron M. Ucko Date: Thu May 9 16:36:31 2024 -0400 Improve support for TDS 5 (Sybase) bulk transfers. * Read defaults, send them back explicitly as needed, and clean up their storage afterwards. * tds5_bcp_add_variable_columns: ** Send spaces in lieu of fully empty SYB(VAR)CHAR data. ** Send correct textpos values in all cases. ** When writing the adjustment table, avoid a potential Sybase "row format error" by eliding the (effective) column count when it would have repeated the largest adjustment table entry. * tds_deinit_bcpinfo: Free and reset current_row for transfers in. Avoid potentially trying to interpret fragments of outgoing TDS data as BLOB pointers. Author: Frediano Ziglio Date: Mon Dec 1 19:37:18 2025 +0000 odbc: Fix for SQL_COPT_SS_OLDPWD attribute This attribute allows to change the password while logging to the server. Code was wrongly taking the length of the attribute in characters instead of bytes causing a failure using wide function. Author: Frediano Ziglio Date: Wed Nov 19 23:57:13 2025 +0000 Fix ABI breakage for tdsdump_open under Windows tdsdump_open is exported by our DB-Library implementation. Before version 1.5 tdsdump_open always accepted a "const char*" string, however in 1.5 this was changed to "const wchar_t*" for Windows to support Unicode. This broke ABI for Windows. Provide tdsdump_open with old ABI and a new tdsdump_wopen (Windows only). Author: Matt McNabb Date: Thu Oct 30 21:26:10 2025 -0400 odbc: Re-prepare a prepared query if it never returned a handle Merge: b95ce1e6 e39070ff Author: Frediano Ziglio Date: Thu Oct 30 06:30:11 2025 +0000 Merge fix for SQLPutData Author: Frediano Ziglio Date: Thu Oct 23 19:45:03 2025 +0100 odbc: Fix inserting too much data with SQLPutData An error is returned if column is truncate. Author: Frediano Ziglio Date: Wed Oct 8 16:35:57 2025 +0100 odbc: Accept any variable data type using DATA_AT_EXEC length Reported in https://github.com/FreeTDS/freetds/issues/667. The behaviour is consistent with Microsoft driver. This caused an issue using PHP ODBC PDO driver. Author: Frediano Ziglio Date: Tue Oct 14 21:35:22 2025 +0100 ci: Update win-iconv version Pick up more recent master version, already including my fix. Author: Frediano Ziglio Date: Wed Sep 10 17:53:56 2025 +0100 dblib: Expand buffers to hold converted floating point Make sure there's enough space for converting the numbers. This fixes fisql command printing real/float values. Author: Frediano Ziglio Date: Thu Aug 28 21:02:57 2025 +0100 Use CORK flag correctly, do not delay partial packets Resetting TCP_CORK flag in Linux causes the partial packets to be flushed however if the queue is full partial packets are not moved to the queue. Partial packets are then processed when space is available. However FreeTDS used to set again the flag causing partial packets to be delayed. Remove that delay reducing latency. Merge: 569401e6 65efc2d5 Author: Frediano Ziglio Date: Wed Jun 25 17:15:09 2025 +0100 Merge test for vasprintf for VMS Author: Craig A. Berry Date: Tue Jun 24 10:38:20 2025 -0500 VMS has had vsnprintf for a long time And this allows for a better vasprintf fallback for systems where vasprintf is not available. Author: Craig A. Berry Date: Mon Jun 23 07:26:27 2025 -0500 Better test for vasprintf on VMS Recentish CRTLs do have it, but the test I added 23 years ago was not correctly detecting it. Author: Frediano Ziglio Date: Wed Jun 18 11:08:10 2025 +0100 tds: Fix bulk copy in for Microsoft XML type As documented, and tested, the protocol requires the usage of NVARCHAR type, not XML, which is refused causing an error. Merge: 349445e4 6c532e2a Author: Frediano Ziglio Date: Sat May 31 17:43:29 2025 +0100 Fix conversion bound checks, tsql message formatting Author: Frediano Ziglio Date: Sat May 31 17:02:34 2025 +0100 tds: Fix bound check conversion (float -> uint) Converting from floating point to unsigned int the bound check was incorrect resulting in invalid conversions if the input value was not in range. Author: Frediano Ziglio Date: Sat May 31 17:00:18 2025 +0100 tsql: Avoid possible invalid type formatting a message Specifically: tsql.c: In function ‘do_query’: tsql.c:292:80: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘__suseconds64_t’ {aka ‘long long int’} [-Wformat=] 292 | sprintf(message, "Total time for processing %d rows: %ld msecs\n", | ~~^ | | | long int | %lld 293 | rows, (long) ((stop.tv_sec - start.tv_sec) * 1000) + ((stop.tv_usec - start.tv_usec) / 1000)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | __suseconds64_t {aka long long int} long should be enough for 49 days in case of 32 bit, I hope your query doesn't take so long. Author: Frediano Ziglio Date: Mon Apr 21 15:58:08 2025 +0100 ctlib: Remove leak freeing command Release cursor while freeing command.