georg           Mon Nov  1 02:19:26 2004 EDT

  Modified files:              
    /php-src/ext/mysqli mysqli_api.c mysqli_nonapi.c 
    /php-src/ext/mysqli/tests   003.phpt 020.phpt 
  Log:
  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.93&r2=1.94&ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.93 php-src/ext/mysqli/mysqli_api.c:1.94
--- php-src/ext/mysqli/mysqli_api.c:1.93        Sat Sep  4 10:16:52 2004
+++ php-src/ext/mysqli/mysqli_api.c     Mon Nov  1 02:19:23 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.93 2004/09/04 14:16:52 georg Exp $ 
+  $Id: mysqli_api.c,v 1.94 2004/11/01 07:19:23 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,16 +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;
 
        if (var_cnt != mysql_stmt_field_count(stmt->stmt)) {
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.36&r2=1.37&ty=u
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.36 php-src/ext/mysqli/mysqli_nonapi.c:1.37
--- php-src/ext/mysqli/mysqli_nonapi.c:1.36     Tue Oct 19 01:14:09 2004
+++ php-src/ext/mysqli/mysqli_nonapi.c  Mon Nov  1 02:19:24 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_nonapi.c,v 1.36 2004/10/19 05:14:09 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.37 2004/11/01 07:19:24 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -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.3&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.3
--- 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:19:26 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.4&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.4
--- 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:19:26 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

Reply via email to