ID:               32093
 Updated by:       [EMAIL PROTECTED]
 Reported By:      michael at kofler dot cc
-Status:           Open
+Status:           Assigned
 Bug Type:         MySQLi related
 Operating System: win + linux
 PHP Version:      5.0.3
-Assigned To:      
+Assigned To:      georg


Previous Comments:
------------------------------------------------------------------------

[2005-02-24 16:37:25] michael at kofler dot cc

Description:
------------
PHP's mysqli_next_result uses mysql_next_result of the C API

the C function returns:

  0  (OK, there are more results)
  -1 (OK, there are no more results)
  >0 (error code for the next result)

  see http://dev.mysql.com/doc/mysql/en/mysql-next-result.html

however, the PHP function mysqli_next_result returns only TRUE (more
results) or FALSE (error or no more results)

as a consequence, when processing a multi query, it is impossible to
detect whether an error happend in the 2nd, 3rd etc. SQL command

Reproduce code:
---------------
  $cmd="SELECT 1;SELECT 2;SELECT bogus;SELECT 4";
  $ok = $mysqli->multi_query($cmd);
  // $ok is TRUE if the 1st SQL command was OK
  // errors in further SQL commandos do not affect $ok
  // this is to be expected, C API behave the same way

  if($ok) {
    do {
      $result = $mysqli->store_result();
      if($result) {
        ... show result ...
        $result->close();
      }
      // at this point, I would like to detect
      // whether the next result has errors or not !!!!
      $next = $mysqli->next_result();
      echo "<p>next=$next</p>\n";
    } while($next);
  }


Expected result:
----------------
I want to get this output

[result 1 ...]
next=1
[result 2 ...]
next=n > 0 so I know an error happend with the 3rd result

Actual result:
--------------
[result 1 ...]
next=1
[result 2 ...]
next=
  (this gives me no idea whether all results have
   been processed all right or whether an error has happenend)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32093&edit=1

Reply via email to