<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-07-09 17:34 GMT+02:00 Isaac Bennetch <span dir="ltr"><<a href="mailto:bennetch@gmail.com" target="_blank">bennetch@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello,<br>
<br>
In the course of my testing the new input transformation feature, I've<br>
encountered some trouble that Chirayu is unable to reproduce. We've had<br>
a bit of discussion privately about it, but wanted to move discussion<br>
back to the mailing list.<br>
<br>
Note that running his branch[1] will change your pma__column_info table<br>
structure; so you may wish to back it up for testing purposes.<br>
<br>
The problem at the moment is the automatic table upgrade feature. What<br>
is supposed to happen is that, when logging in,<br>
PMA_checkRelationsParam() verifies that the correct table structure<br>
exists for pma__column_info. If it doesn't, it attempts to run<br>
./examples/upgrade_column_info_4_3_0+.sql (after substituting the<br>
correct database and table names if needed). This is all quite good.<br>
<br>
On my system, what happens, however, is that<br>
<br>
$GLOBALS['dbi']->tryMultiQuery($query, $GLOBALS['controllink'])<br>
<br>
doesn't work. It returns 1 (which I presume is just how print_r<br>
represents TRUE), but the query doesn't execute ($query in this case is<br>
essentially the contents of the .sql file; several SQL statements with<br>
semicolons and newline characters and a few comments). It works properly<br>
on Chirayu's system but silently fails on mine.<br>
<br>
I'm hoping to get additional testing on the "silent upgrade" feature<br>
(or, for that matter, thoughts about the problem). At this point, I'm<br>
the only one for whom it fails, which is quite interesting. To test,<br>
simply checkout the branch and open phpMyAdmin, then check your<br>
pma__column_info table; it should have two new columns at the end (input_*).<br>
<br>
Thanks!<br>
<br>
Some more detailed information if you really want to read on:<br>
<br>
Around line 610, instead of directly testing the result of the<br>
tryMultiQuery in the if statement, I assign it to a variable then<br>
print_r that variable and get a message about "Commands out of sync; you<br>
can't run this command now".<br>
<br>
$ipb_test = $GLOBALS['dbi']->tryMultiQuery($query,<br>
$GLOBALS['controllink'] );<br>
die("<pre>" . print_r($GLOBALS['controllink']) . "</pre>");<br>
if ($ipb_test !== false ) {<br>
return true;<br>
<br>
mysqli Object ( [affected_rows] => 0 [client_info] => 5.5.37<br>
[client_version] => 50537 [connect_errno] => 0 [connect_error] =><br>
[errno] => 0 [error] => [error_list] => Array ( ) [field_count] => 0<br>
[host_info] => Localhost via UNIX socket [info] => [insert_id] => 0<br>
[server_info] => 5.5.37-0+wheezy1 [server_version] => 50537 [stat] =><br>
Commands out of sync; you can't run this command now [sqlstate] => HY000<br>
[protocol_version] => 10 [thread_id] => 6069 [warning_count] => 0 )<br>
<br>
I'm not familiar enough with tryMultiQuery to know why [stat] contains<br>
this message.<br>
<br>
According to [2], it appears as if there is a problem with executing the<br>
code because either we haven't used mysql_free_result() or<br>
mysql_use_result() or mysql_store_result() since a previous query.<br>
<br>
We've looked at mysqli_multi_query()<br>
(<a href="http://www.php.net/manual/en/mysqli.multi-query.php" target="_blank">http://www.php.net/manual/en/mysqli.multi-query.php</a>), which<br>
is called by tryMultiQuery() depending on your DBI Extension (mine<br>
is mysqli). It says that it returns false when First statement is<br>
failed. See the return values section of it.<br>
<br>
Note that my mysqli object claims 0 rows were affected but also didn't<br>
return false. I expect that the 87 rows in my pma__column_info would<br>
have been affected by the first line (ALTER...).<br>
<br>
1 - <a href="https://github.com/D-storm/phpmyadmin/commits/FR-637" target="_blank">https://github.com/D-storm/phpmyadmin/commits/FR-637</a><br>
2 - <a href="https://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html" target="_blank">https://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html</a><br>
</blockquote></div><br></div><div class="gmail_extra">Hi,</div><div class="gmail_extra"><br></div><div class="gmail_extra">It seems that I found the same information while reading your email and doing some research on internet about mysqli_multi_query and its return.</div>
<div class="gmail_extra">So maybe we need to improve PMA_DBI_Mysqli::realMultiQuery to return the real error status.</div><div class="gmail_extra"><br></div><div class="gmail_extra">But first maybe, you can try something like this in this method (I didn't test it…):</div>
<div class="gmail_extra">if ($r = mysqli_multi_query($link, $query)) {</div><div class="gmail_extra"><div class="gmail_extra"> do {</div><div class="gmail_extra"> if ($result = mysqli_store_result($link)) {</div>
<div class="gmail_extra"> echo 'ok.<br />';</div><div class="gmail_extra"> mysqli_free_result($result);</div><div class="gmail_extra"> } else {</div><div class="gmail_extra"> $r = false;</div>
<div class="gmail_extra"> echo 'KO<br />'; //Do you know a way get the query here? I didn't find one…</div><div class="gmail_extra"> }</div><div class="gmail_extra"> } while (mysqli_next_result($link));</div>
<div class="gmail_extra">}</div><div class="gmail_extra">return $r;</div><div class="gmail_extra"><br></div><div class="gmail_extra">Then, you'll know the query which failed.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
We're waiting for your feedback. (I'll try… to try…)</div><div class="gmail_extra">Hugues.</div></div></div>