diff options
author | Wez Furlong <wez@php.net> | 2006-10-11 02:10:56 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2006-10-11 02:10:56 +0000 |
commit | 391ed04adb229c1eb87fb2928c9d56024ccab10e (patch) | |
tree | 3910f9557ea932312e441fd242c5dbfcc88b93bc /ext/pdo_odbc/odbc_stmt.c | |
parent | ea2d32381ddc872f6cee843675fd3c49a3cb9c0d (diff) | |
download | php-git-391ed04adb229c1eb87fb2928c9d56024ccab10e.tar.gz |
Fix for PECL bug #8944. Could also be the same problem as pecl #7775.
Diffstat (limited to 'ext/pdo_odbc/odbc_stmt.c')
-rwxr-xr-x | ext/pdo_odbc/odbc_stmt.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 628779f033..ae751cb5ec 100755 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2005 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -404,6 +404,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) * column. */ if (colsize < 256 && !S->going_long) { S->cols[colno].data = emalloc(colsize+1); + S->cols[colno].is_long = 0; rc = SQLBindCol(S->stmt, colno+1, SQL_C_CHAR, S->cols[colno].data, S->cols[colno].datalen+1, &S->cols[colno].fetched_len); @@ -417,6 +418,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) * "long" columns */ S->cols[colno].data = emalloc(256); S->going_long = 1; + S->cols[colno].is_long = 1; } return 1; @@ -428,7 +430,7 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l pdo_odbc_column *C = &S->cols[colno]; /* if it is a column containing "long" data, perform late binding now */ - if (C->datalen > 255) { + if (C->is_long) { unsigned long alloced = 4096; unsigned long used = 0; char *buf; @@ -468,6 +470,11 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l if (rc == SQL_NO_DATA) { /* we got the lot */ break; + } else if (rc != SQL_SUCCESS) { + pdo_odbc_stmt_error("SQLGetData"); + if (rc != SQL_SUCCESS_WITH_INFO) { + break; + } } if (C->fetched_len == SQL_NO_TOTAL) { @@ -476,6 +483,11 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned l used += C->fetched_len; } + if (rc == SQL_SUCCESS) { + /* this was the final fetch */ + break; + } + /* we need to fetch another chunk; resize the * buffer */ alloced *= 2; |