com php-src: fix bug #69381: ext/odbc/php_odbc.c

From: Date: Tue, 28 Apr 2015 13:02:48 +0000
Subject: com php-src: fix bug #69381: ext/odbc/php_odbc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-86534@lists.php.net to get a copy of this message
Commit: 268eb1999b1598a2a1a875c5f0172d5b615811ac Author: Anatol Belski <ab@php.net> Tue, 28 Apr 2015 15:02:48 +0200 Parents: ac275f9e31379b058050a0139ec9b4dea8ea0013 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=268eb1999b1598a2a1a875c5f0172d5b615811ac Log: fix bug #69381 a simpler version is to be backported Bugs: https://bugs.php.net/69381 Changed paths: M ext/odbc/php_odbc.c Diff: diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 3015441..9e51dca 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -993,6 +993,27 @@ int odbc_bindcols(odbc_result *result) 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) { + SQLINTEGER err; + SQLCHAR errtxt[128]; + SQLCHAR state[6]; + + memset(errtxt, '\0', 128); + memset(state, '\0', 6); + + if (SQL_SUCCESS == SQLGetDiagRec(SQL_HANDLE_STMT, result->stmt, 1, state, &err, errtxt, 128, NULL)) { + errtxt[127] = '\0'; + state[5] = '\0'; + php_error_docref(NULL, E_WARNING, "SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH: [%s] %s", state, errtxt); + } + /* 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;

« previous php.cvs (#86534) next »