hholzgra                Tue Jan  1 16:51:09 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/mysqli/tests   bug42548.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/mysqli mysqli_api.c 
  Log:
  MFH: Fix for bug #42548 "PROCEDURE xxx can't return a result set"
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1044&r2=1.2027.2.547.2.1045&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1044 php-src/NEWS:1.2027.2.547.2.1045
--- php-src/NEWS:1.2027.2.547.2.1044    Sun Dec 30 17:59:30 2007
+++ php-src/NEWS        Tue Jan  1 16:51:08 2008
@@ -59,6 +59,7 @@
 - Fixed bug #42736 (xmlrpc_server_call_method() crashes). (Tony)
 - Fixed bug #42692 (Procedure 'int1' not present with doc/lit SoapServer).
   (Dmitry)
+- Fixed bug #42548 (mysqli PROCEDURE calls can't return result sets). (hartmut)
 - Fixed bug #42272 (var_export() incorrectly escapes char(0)). (Derick)
 - Fixed bug #42261 (Incorrect lengths for date and boolean data types).
   (Ilia)
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.22.2.19&r2=1.118.2.22.2.20&diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.22.2.19 
php-src/ext/mysqli/mysqli_api.c:1.118.2.22.2.20
--- php-src/ext/mysqli/mysqli_api.c:1.118.2.22.2.19     Mon Dec 31 07:20:08 2007
+++ php-src/ext/mysqli/mysqli_api.c     Tue Jan  1 16:51:09 2008
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.118.2.22.2.19 2007/12/31 07:20:08 sebastian Exp $ 
+  $Id: mysqli_api.c,v 1.118.2.22.2.20 2008/01/01 16:51:09 hholzgra Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1438,6 +1438,9 @@
 
        MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", 
MYSQLI_STATUS_INITIALIZED);
 
+
+       /* set some required options */
+       flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
        /* remove some insecure options */
        flags &= ~CLIENT_MULTI_STATEMENTS;   /* don't allow multi_queries via 
connect parameter */
        if ((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) 
{

http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug42548.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/bug42548.phpt
+++ php-src/ext/mysqli/tests/bug42548.phpt
--TEST--
Bug #42548 PROCEDURE xxx can't return a result set in the given context (works 
in 5.2.3!!)
--SKIPIF--
<?php if (!extension_loaded("mysqli")) print "skip"; ?>
--FILE--
<?php
$mysqli = mysqli_init();
$mysqli->real_connect('localhost', 'root', '', 'test');
if (mysqli_connect_errno()) {
  printf("Connect failed: %s\n", mysqli_connect_error());
  exit();
}

$mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
$mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or 
die($mysqli->error);

if ($mysqli->multi_query("CALL p1();"))
{       
  do    
  {     
    if ($objResult = $mysqli->store_result()) {
      while ($row = $objResult->fetch_assoc()) {
        print_r($row);
      }
      $objResult->close();
      if ($mysqli->more_results()) {
        print "----- next result -----------\n";
      }
    } else {
      print "no results found";
    }
  } while ($mysqli->more_results() && $mysqli->next_result());
} else {
  print $mysqli->error;
}

$mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
$mysqli->close();
?>
--EXPECT--      
Array
(
    [23] => 23
)
----- next result -----------
Array
(
    [42] => 42
)
----- next result -----------
no results found

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to