<div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
>> I'm trying to implement titled case related to bug [0].<br>
>> In current code, any SQL going to executed via SQL window, is processed and<br>
>> if there are more SQL queries, it detect only one query.<br>
>> So whole statement with any valid number of SQl queries need to be detected.<br>
>> Then by using mysql_multi_query() function all results related to multiple<br>
>> queries can be obtained.<br>
>> As I think displaying these results can be done with looping the result<br>
>> sets.<br>
>><br>
>> Additionally I saw mysql_multi_query manual [1] mentioned that separate<br>
>> queries are identified by semicolon.<br>
>> May be I need to replace the delimiter if it is not a semicolon.<br>
><br>
> It is not possible to replace it in all cases - eg. when creating<br>
> procedures. So it might be better to run mysqli_query and collect<br>
> results manually?<br>
><br>
> I think Rouslan might have some ideas here as well as he is quite<br>
> familiar with stored procedures and related stuff.<br>
<br>
</div></div>I'm not too sure what the question is, but I can explain the current<br>
state of the support for stored routines, which might be of help. First<br>
of all, the mysql extension does not support multiple result sets, so<br>
it's possible to execute stored routines that return one result set<br>
only. Drizzle has no support for stored routines, so you don't need to<br>
worry about that either.<br>
Now onto the more interesting stuff. The support for executing stored<br>
routines in pma is quite incomplete. The relevant code can  be found in<br>
the file libraries/rte/rte_rtoutines.lib.php, around line 1260 [0]. At<br>
the time that I was writing that code, I was convinced that a stored<br>
routines could only ever return one row of data (there is even a comment<br>
in the code stating this). Later I discovered that not only this was not<br>
true, and there could be multiple rows returned, but that it is even<br>
possible to return multiple sets of rows. So, I 've actually only<br>
implemented enough of the multi query support so that the "COMMANDS OUT<br>
OF SYNC" error is not thrown by MySQL when executing the routines.<br>
<br>
As a practical example, let say that you have the following routine in<br>
the sakila db:<br>
<br>
CREATE PROCEDURE `test`()<br>
BEGIN<br>
SELECT 1;<br>
SELECT 2;<br>
SELECT 3;<br>
END<br>
<br>
The code required to display all of it's results would be:<br>
<br>
<?php<br>
// standalone file, somewhere in the pma root folder<br>
include 'libraries/common.inc.php';<br>
PMA_DBI_select_db("sakila");<br>
$query = "CALL test();";<br>
$resource = mysqli_multi_query($GLOBALS['userlink'], $query);<br>
$i = 0;<br>
do {<br>
     if ($result = mysqli_use_result($GLOBALS['userlink'])) {<br>
         echo "result " . ++$i . "<br />";<br>
         while ($row = mysqli_fetch_row($result) ) {<br>
             printf("%s<br />", $row[0]);<br>
         }<br>
     }<br>
} while(PMA_DBI_more_results() && PMA_DBI_next_result());<br>
?><br>
<br>
As can be seen in the above code, some of the function calls are missing<br>
in our database abstraction layer and instead native mysqli function<br>
calls are used. These missing functions need to be implemented first.<br>
Btw, the above code is not a straight fit for how to execute the<br>
routines in pma, as there are other queries that need to be run, etc,<br>
etc. However it should give a good idea of what's missing.<br>
<br>
Bye,<br>
Rouslan<br>
<br>
[0]:<br>
<a href="https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/rte/rte_routines.lib.php#L1260" target="_blank">https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/rte/rte_routines.lib.php#L1260</a><br>

</blockquote></div><br><div>Hi <span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif">Rouslan,</span>
</div><div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif">Thanks for your very descriptive explanation.</span></div>
<div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif">I am not good at store procedures and routines.</span></div><div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif">I'm currently trying to display multiple results which executing trhought the SQL window.</span></div>
<div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif">I'll immediately move into this and</span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"> I'll need your help in this case.</span></div>
<div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif"><br></span></div><div><span style="font-size:13px;background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif">Regards !</span></div>
<div><br></div>