From f505d112074d7d0693ee6829945865b4788f777f Mon Sep 17 00:00:00 2001 From: Frederic Marchal Date: Tue, 28 Apr 2015 15:08:53 +0200 Subject: 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. --- ext/odbc/php_odbc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ext/odbc/php_odbc.c') 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; -- cgit v1.2.1