summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Marchal <frederic.marchal@wowtechnology.com>2015-04-28 15:08:53 +0200
committerAnatol Belski <ab@php.net>2015-04-28 15:08:53 +0200
commitf505d112074d7d0693ee6829945865b4788f777f (patch)
treeebb9797742dcaced9df11c9d68ccb1cbcd46204e
parent768bbedf8233dad6c1709b536f8db20d4496a7cc (diff)
downloadphp-git-f505d112074d7d0693ee6829945865b4788f777f.tar.gz
Fixed bug #69381 out of memory with sage odbc driver
This is just a hotfix as there are still drivers with no full ODBC 3.x support. This patch origins from bug #68350 which was solved by the proper 3.0 migration, another driver (Sage) turned out to have the real issue.
-rw-r--r--ext/odbc/php_odbc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 231e8144f9..ddfbc4edbe 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -999,6 +999,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
default:
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
NULL, 0, NULL, &displaysize);
+#if defined(ODBCVER) && (ODBCVER >= 0x0300)
+ if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && colfieldid == SQL_DESC_OCTET_LENGTH) {
+ /* This is a quirk for ODBC 2.0 compatibility for broken driver implementations.
+ */
+ charextraalloc = 1;
+ rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE,
+ NULL, 0, NULL, &displaysize);
+ }
+#endif
/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
if (result->values[i].coltype == SQL_TIMESTAMP) {
displaysize += 3;