php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #68350
Patch ads_odbc_exec.patch revision 2014-11-05 12:49 UTC by frederic dot marchal at wowtechnology dot com

Patch ads_odbc_exec.patch for ODBC related Bug #68350

Patch version 2014-11-05 12:49 UTC

Return to Bug #68350 | Download this patch
Patch Revisions:

Developer: frederic.marchal@wowtechnology.com

diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 6729163..23b22d5 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -993,6 +993,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
 			default:
 				rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
 								NULL, 0, NULL, &displaysize);
+				if (colfieldid == SQL_DESC_OCTET_LENGTH && rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
+					/* Fallback to old method because ADS ODBC driver version 11 doesn't support
+					 * SQL_DESC_OCTET_LENGTH.
+					 */
+					charextraalloc = 1;
+					rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE,
+									NULL, 0, NULL, &displaysize);
+				}
+
 				/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
 				if (result->values[i].coltype == SQL_TIMESTAMP) {
 					displaysize += 3;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 21:01:28 2024 UTC