andrey Sat Jul 9 22:49:17 2005 EDT Modified files: /php-src/ext/pdo_mysql mysql_statement.c Log: ok, calculate max_length only in case of a blob (normal, medium, long). in case of a varchar lets allocate 255 bytes and be quick without asking libmysql to update max_length http://cvs.php.net/diff.php/php-src/ext/pdo_mysql/mysql_statement.c?r1=1.38&r2=1.39&ty=u Index: php-src/ext/pdo_mysql/mysql_statement.c diff -u php-src/ext/pdo_mysql/mysql_statement.c:1.38 php-src/ext/pdo_mysql/mysql_statement.c:1.39 --- php-src/ext/pdo_mysql/mysql_statement.c:1.38 Sat Jul 9 22:20:26 2005 +++ php-src/ext/pdo_mysql/mysql_statement.c Sat Jul 9 22:49:14 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysql_statement.c,v 1.38 2005/07/10 02:20:26 andrey Exp $ */ +/* $Id: mysql_statement.c,v 1.39 2005/07/10 02:49:14 andrey Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -94,7 +94,25 @@ /* if buffered, pre-fetch all the data */ if (H->buffered) { my_bool on = 1; - mysql_stmt_attr_set(S->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &on); + /* if we have bound the buffers don't set the attribute again */ + if (!S->result) { + for (i= 0; i < stmt->column_count; i++) { + /* + FIXME: using directly internal structs - but for now cleaner + then calling 2 times result_metadata. + */ + switch (S->fields[i].type) { + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + mysql_stmt_attr_set(S->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &on); + i= stmt->column_count; + break; + default: + break; + } + } + } mysql_stmt_store_result(S->stmt); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php