diff options
-rwxr-xr-x | ext/pdo_odbc/odbc_driver.c | 2 | ||||
-rwxr-xr-x | ext/pdo_odbc/odbc_stmt.c | 16 | ||||
-rwxr-xr-x | ext/pdo_odbc/pdo_odbc.c | 2 | ||||
-rw-r--r-- | ext/pdo_odbc/php_pdo_odbc.h | 2 | ||||
-rwxr-xr-x | ext/pdo_odbc/php_pdo_odbc_int.h | 3 |
5 files changed, 19 insertions, 6 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 5585cecf38..1f0114156e 100755 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.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 | 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; diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index 65c999df8f..38cd3e7f15 100755 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.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 | diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h index 8d290b38b4..d089d8311e 100644 --- a/ext/pdo_odbc/php_pdo_odbc.h +++ b/ext/pdo_odbc/php_pdo_odbc.h @@ -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 | diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h index 8e6630052e..2653ced6b3 100755 --- a/ext/pdo_odbc/php_pdo_odbc_int.h +++ b/ext/pdo_odbc/php_pdo_odbc_int.h @@ -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 | @@ -137,6 +137,7 @@ typedef struct { long fetched_len; SWORD coltype; char colname[128]; + unsigned is_long; } pdo_odbc_column; typedef struct { |