summaryrefslogtreecommitdiff
path: root/ext/odbc/php_odbc.c
diff options
context:
space:
mode:
authorKeyur Govande <keyur@php.net>2014-10-07 21:17:36 +0000
committerKeyur Govande <keyur@php.net>2014-10-07 21:17:36 +0000
commitdf9078ea55e2bd60d718c6e6948b70311650fe39 (patch)
tree31d9c8c67ac657f21d2b06f05a6c44280e632d2a /ext/odbc/php_odbc.c
parentd21602c07288283e680941c0c0f963715fed0337 (diff)
downloadphp-git-df9078ea55e2bd60d718c6e6948b70311650fe39.tar.gz
Fix for bug #68087 (ODBC not reading DATE columns correctly)
Temporary variable indicating column field type ID should be reset to default for loop iteration (i.e. every column in the record set. The old buggy code made it persist across all columns leading to invalid reads from the buffer, if for example a DATE column was preceded by a VARCHAR column.
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r--ext/odbc/php_odbc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 19f9fe4eb0..b9bee9676a 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -951,14 +951,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
SQLUSMALLINT colfieldid;
int charextraalloc;
- colfieldid = SQL_COLUMN_DISPLAY_SIZE;
- charextraalloc = 0;
result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0);
result->longreadlen = ODBCG(defaultlrl);
result->binmode = ODBCG(defaultbinmode);
for(i = 0; i < result->numcols; i++) {
+ charextraalloc = 0;
+ colfieldid = SQL_COLUMN_DISPLAY_SIZE;
+
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME,
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,