Skip to content

Commit f505d11

Browse files
Frederic Marchalweltling
authored andcommitted
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.
1 parent 768bbed commit f505d11

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/odbc/php_odbc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
999999
default:
10001000
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
10011001
NULL, 0, NULL, &displaysize);
1002+
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
1003+
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && colfieldid == SQL_DESC_OCTET_LENGTH) {
1004+
/* This is a quirk for ODBC 2.0 compatibility for broken driver implementations.
1005+
*/
1006+
charextraalloc = 1;
1007+
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE,
1008+
NULL, 0, NULL, &displaysize);
1009+
}
1010+
#endif
10021011
/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
10031012
if (result->values[i].coltype == SQL_TIMESTAMP) {
10041013
displaysize += 3;

0 commit comments

Comments
 (0)