andrey Mon Jul 11 09:52:15 2005 EDT Modified files: /php-src/ext/pdo_mysql mysql_driver.c Log: - mysql_affected_rows() already returns an unsigned long - optimize a bit the real_escape - handle the situation when libmysql bails out because of lack of memory http://cvs.php.net/diff.php/php-src/ext/pdo_mysql/mysql_driver.c?r1=1.53&r2=1.54&ty=u Index: php-src/ext/pdo_mysql/mysql_driver.c diff -u php-src/ext/pdo_mysql/mysql_driver.c:1.53 php-src/ext/pdo_mysql/mysql_driver.c:1.54 --- php-src/ext/pdo_mysql/mysql_driver.c:1.53 Fri Jul 8 15:25:37 2005 +++ php-src/ext/pdo_mysql/mysql_driver.c Mon Jul 11 09:52:13 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysql_driver.c,v 1.53 2005/07/08 19:25:37 wez Exp $ */ +/* $Id: mysql_driver.c,v 1.54 2005/07/11 13:52:13 andrey Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -225,8 +225,7 @@ pdo_mysql_error(dbh); return -1; } else { - long c = mysql_affected_rows(H->server); - return c >0 ? c : 0; + return mysql_affected_rows(H->server); } } @@ -242,11 +241,9 @@ { pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data; *quoted = emalloc(2*unquotedlen + 3); - (*quoted)[0] = '"'; *quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, unquotedlen); - (*quoted)[*quotedlen + 1] = '"'; - (*quoted)[*quotedlen + 2] = '\0'; - *quotedlen += 2; + (*quoted)[0] =(*quoted)[*quotedlen + 1] = '"'; + (*quoted)[*quotedlen+=2] = '\0'; return 1; } @@ -329,7 +326,7 @@ case PDO_ATTR_AUTOCOMMIT: ZVAL_LONG(return_value, dbh->auto_commit); return 1; - + case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY: ZVAL_LONG(return_value, H->buffered); return 1; @@ -398,7 +395,11 @@ /* allocate an environment */ /* handle for the server */ - H->server = mysql_init(NULL); + if (!(H->server = mysql_init(NULL))) { + pdo_mysql_error(dbh); + goto cleanup; + } + dbh->driver_data = H; /* handle MySQL options */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php