wez Mon Mar 27 21:04:12 2006 UTC Modified files: (Branch: PHP_5_1) /php-src/ext/pdo_odbc odbc_stmt.c php_pdo_odbc_int.h Log: Fix for #36342; ODBC won't let you bind variables by buffer after "long" columns. We simply add a flag that indicates if we've seen any long columns and will continue to bind the columns the slow way. While we're at it, increase the maximum length of the column names that we can handle. http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_odbc/odbc_stmt.c?r1=1.26.2.1&r2=1.26.2.2&diff_format=u Index: php-src/ext/pdo_odbc/odbc_stmt.c diff -u php-src/ext/pdo_odbc/odbc_stmt.c:1.26.2.1 php-src/ext/pdo_odbc/odbc_stmt.c:1.26.2.2 --- php-src/ext/pdo_odbc/odbc_stmt.c:1.26.2.1 Fri Sep 30 04:19:24 2005 +++ php-src/ext/pdo_odbc/odbc_stmt.c Mon Mar 27 21:04:12 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: odbc_stmt.c,v 1.26.2.1 2005/09/30 04:19:24 wez Exp $ */ +/* $Id: odbc_stmt.c,v 1.26.2.2 2006/03/27 21:04:12 wez Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -146,6 +146,7 @@ stmt->column_count = (int)colcount; S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); + S->going_long = 0; } return 1; @@ -399,8 +400,9 @@ col->param_type = PDO_PARAM_STR; /* tell ODBC to put it straight into our buffer, but only if it - * isn't "long" data */ - if (colsize < 256) { + * isn't "long" data, and only if we haven't already bound a long + * column. */ + if (colsize < 256 && !S->going_long) { S->cols[colno].data = emalloc(colsize+1); rc = SQLBindCol(S->stmt, colno+1, SQL_C_CHAR, S->cols[colno].data, @@ -414,6 +416,7 @@ /* allocate a smaller buffer to keep around for smaller * "long" columns */ S->cols[colno].data = emalloc(256); + S->going_long = 1; } return 1; @@ -589,6 +592,7 @@ SQLNumResultCols(S->stmt, &colcount); stmt->column_count = (int)colcount; S->cols = ecalloc(colcount, sizeof(pdo_odbc_column)); + S->going_long = 0; return 1; } http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_odbc/php_pdo_odbc_int.h?r1=1.9&r2=1.9.2.1&diff_format=u Index: php-src/ext/pdo_odbc/php_pdo_odbc_int.h diff -u php-src/ext/pdo_odbc/php_pdo_odbc_int.h:1.9 php-src/ext/pdo_odbc/php_pdo_odbc_int.h:1.9.2.1 --- php-src/ext/pdo_odbc/php_pdo_odbc_int.h:1.9 Thu Jul 7 12:49:21 2005 +++ php-src/ext/pdo_odbc/php_pdo_odbc_int.h Mon Mar 27 21:04:12 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pdo_odbc_int.h,v 1.9 2005/07/07 12:49:21 wez Exp $ */ +/* $Id: php_pdo_odbc_int.h,v 1.9.2.1 2006/03/27 21:04:12 wez Exp $ */ #ifdef PHP_WIN32 # define PDO_ODBC_TYPE "Win32" @@ -136,7 +136,7 @@ unsigned long datalen; long fetched_len; SWORD coltype; - char colname[32]; + char colname[128]; } pdo_odbc_column; typedef struct { @@ -144,6 +144,8 @@ pdo_odbc_column *cols; pdo_odbc_db_handle *H; pdo_odbc_errinfo einfo; + unsigned going_long:1; + unsigned _spare:31; } pdo_odbc_stmt; typedef struct {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php