1--TEST-- 2Multiple result set with PS 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8?> 9--FILE-- 10<?php 11 require 'table.inc'; 12 13 if (!$link->query('DROP PROCEDURE IF EXISTS p123')) { 14 printf("[001] [%d] %s\n", $link->error, $link->errno); 15 } 16 17 if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) { 18 printf("[002] [%d] %s\n", $link->error, $link->errno); 19 } 20 21 if (!($stmt = $link->prepare("CALL p123"))) { 22 printf("[003] [%d] %s\n", $stmt->error, $stmt->errno); 23 } 24 25 if (!$stmt->execute()) { 26 printf("[005] [%d] %s\n", $stmt->error, $stmt->errno); 27 } 28 29 $c_id = NULL; 30 $c_label = NULL; 31 if (!$stmt->bind_result($c_id, $c_label)) { 32 printf("[004] [%d] %s\n", $stmt->error, $stmt->errno); 33 } 34 var_dump("pre:",$c_id, $c_label); 35 36 if (!$stmt->fetch()) { 37 printf("[006] [%d] %s\n", $stmt->error, $stmt->errno); 38 } 39 40 var_dump("post:",$c_id, $c_label); 41 42 if ($stmt->fetch()) { 43 printf("[007] Shouldn't have fetched anything\n"); 44 var_dump($c_id, $c_label); 45 } 46 47 if ($stmt->fetch()) { 48 printf("[008] No more rows expected\n"); 49 } 50 51 if (!$stmt->more_results()) { 52 printf("[009] Expected more results\n"); 53 } else { 54 var_dump("[009] next_result:", $stmt->next_result()); 55 } 56 57 if (!$stmt->bind_result($c_id, $c_label)) { 58 printf("[010] [%d] %s\n", $stmt->error, $stmt->errno); 59 } 60 var_dump("pre:",$c_id, $c_label); 61 62 if (!$stmt->fetch()) { 63 printf("[011] [%d] %s\n", $stmt->error, $stmt->errno); 64 } 65 66 var_dump("post:",$c_id, $c_label); 67 68 if ($stmt->fetch()) { 69 printf("[012] No more rows expected\n"); 70 } 71 72 if (!$stmt->more_results()) { 73 printf("[013] Expected more results\n"); 74 } else { 75 var_dump("[013] next_result:", $stmt->next_result()); 76 } 77 78 if ($stmt->more_results()) { 79 printf("[014] No more results expected\n"); 80 } else { 81 printf("[014] No result, as expected\n"); 82 } 83 84 $stmt->close(); 85 $link->close(); 86 87 88 echo "done"; 89?> 90--CLEAN-- 91<?php 92require_once 'connect.inc'; 93$link = new mysqli($host, $user, $passwd, $db, $port, $socket); 94$link->query('DROP PROCEDURE IF EXISTS p123'); 95$link->close(); 96?> 97--EXPECT-- 98string(4) "pre:" 99NULL 100NULL 101string(5) "post:" 102int(13) 103string(6) "a-ahoi" 104string(18) "[009] next_result:" 105bool(true) 106string(4) "pre:" 107int(13) 108string(6) "a-ahoi" 109string(5) "post:" 110int(43) 111string(5) "a---a" 112string(18) "[013] next_result:" 113bool(true) 114[014] No result, as expected 115done 116