georg Mon Nov 1 02:57:46 2004 EDT Modified files: (Branch: PHP_5_0) /php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c /php-src/ext/mysqli/tests 003.phpt 020.phpt Log: MFH: Fixed tests for empty dates (see http://bugs.mysql.com/?id=6058) Fixed memleak in mysqli_stmt_bind_result Fixed error handling for mysqli_multi_query http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.87.2.4&r2=1.87.2.5&ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.87.2.4 php-src/ext/mysqli/mysqli_api.c:1.87.2.5 --- php-src/ext/mysqli/mysqli_api.c:1.87.2.4 Sat Sep 4 10:19:20 2004 +++ php-src/ext/mysqli/mysqli_api.c Mon Nov 1 02:57:45 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.87.2.4 2004/09/04 14:19:20 georg Exp $ + $Id: mysqli_api.c,v 1.87.2.5 2004/11/01 07:57:45 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -217,6 +217,16 @@ zval *mysql_stmt; MYSQL_BIND *bind; + if (getThis()) { + start = 0; + } + + if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { + return; + } + + MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); + if (argc < (getThis() ? 1 : 2)) { WRONG_PARAM_COUNT; } @@ -228,15 +238,6 @@ WRONG_PARAM_COUNT; } - if (getThis()) { - start = 0; - } - - if (zend_parse_method_parameters((getThis()) ? 0:1 TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { - return; - } - - MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt"); var_cnt = argc - start; @@ -601,7 +602,7 @@ if (!(ret = mysql_stmt_fetch(stmt->stmt))) { for (i = 0; i < stmt->result.var_cnt; i++) { if (stmt->result.vars[i]->type == IS_STRING && stmt->result.vars[i]->value.str.len) { - efree(stmt->result.vars[i]->value.str.val); + efree(stmt->result.vars[i]->value.str.val); } if (!stmt->result.is_null[i]) { switch (stmt->result.buf[i].type) { http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.34.2.2&r2=1.34.2.3&ty=u Index: php-src/ext/mysqli/mysqli_nonapi.c diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.34.2.2 php-src/ext/mysqli/mysqli_nonapi.c:1.34.2.3 --- php-src/ext/mysqli/mysqli_nonapi.c:1.34.2.2 Tue Oct 19 01:17:26 2004 +++ php-src/ext/mysqli/mysqli_nonapi.c Mon Nov 1 02:57:45 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: mysqli_nonapi.c,v 1.34.2.2 2004/10/19 05:17:26 georg Exp $ + $Id: mysqli_nonapi.c,v 1.34.2.3 2004/11/01 07:57:45 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -50,8 +50,8 @@ } if (!socket_len) { - socket = NULL; - } + socket = NULL; + } /* TODO: safe mode handling */ if (PG(sql_safe_mode)){ @@ -222,8 +222,23 @@ MYSQLI_ENABLE_MQ; if (mysql_real_query(mysql->mysql, query, query_len)) { - MYSQLI_DISABLE_MQ; + char s_error[MYSQL_ERRMSG_SIZE], s_sqlstate[SQLSTATE_LENGTH+1]; + unsigned int s_errno; MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql); + + /* we have to save error information, cause + MYSQLI_DISABLE_MQ will reset error information */ + strcpy(s_error, mysql_error(mysql->mysql)); + strcpy(s_sqlstate, mysql_sqlstate(mysql->mysql)); + s_errno = mysql_errno(mysql->mysql); + + MYSQLI_DISABLE_MQ; + + /* restore error information */ + strcpy(mysql->mysql->net.last_error, s_error); + strcpy(mysql->mysql->net.sqlstate, s_sqlstate); + mysql->mysql->net.last_errno = s_errno; + RETURN_FALSE; } RETURN_TRUE; http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/003.phpt?r1=1.2&r2=1.2.2.1&ty=u Index: php-src/ext/mysqli/tests/003.phpt diff -u php-src/ext/mysqli/tests/003.phpt:1.2 php-src/ext/mysqli/tests/003.phpt:1.2.2.1 --- php-src/ext/mysqli/tests/003.phpt:1.2 Sat Jun 28 17:30:58 2003 +++ php-src/ext/mysqli/tests/003.phpt Mon Nov 1 02:57:46 2004 @@ -50,7 +50,7 @@ [4]=> string(19) "2010-07-10 00:00:00" [5]=> - string(0) "" + string(19) "0000-00-00 00:00:00" [6]=> string(19) "1999-12-29 00:00:00" } http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/020.phpt?r1=1.3&r2=1.3.2.1&ty=u Index: php-src/ext/mysqli/tests/020.phpt diff -u php-src/ext/mysqli/tests/020.phpt:1.3 php-src/ext/mysqli/tests/020.phpt:1.3.2.1 --- php-src/ext/mysqli/tests/020.phpt:1.3 Wed Feb 11 02:39:28 2004 +++ php-src/ext/mysqli/tests/020.phpt Mon Nov 1 02:57:46 2004 @@ -58,7 +58,7 @@ [4]=> string(19) "2010-07-10 00:00:00" [5]=> - string(0) "" + string(19) "0000-00-00 00:00:00" [6]=> string(19) "1999-12-29 00:00:00" }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php