[Phpmyadmin-devel] current HEAD, MySQL 4.0.x and mysqli
Marc Delisle
Marc.Delisle at cegepsherbrooke.qc.ca
Fri Oct 14 07:45:39 CEST 2005
Marc Delisle a écrit :
> Sebastian Mendel a écrit :
>
>> Marc Delisle wrote:
>>
>>> Hi,
>>>
>>> can someone reproduce this? HEAD no longer works correctly with MySQL
>>> 4.0.x, with mysqli extension. Many symptoms occur, for example:
>>> structure only shows the first 7 fields of a table; insert no longer
>>> works, etc.
>>>
>>> Looks like the output of SHOW FIELDS, when fetched in a loop by
>>> PMA_DBI_fetch_assoc(), stops after reading the 7th row.
>>>
>>> Same server works well with QA_2_6_4 + mysqli extension. Works well
>>> with HEAD + mysql extension.
>>>
>>> I know that mysqli is targeted to MySQL 4.1.x+, but...
>>
>>
>>
>> oh, i dont see there any 'but'
>>
>> mysqli uses many new api functions not supported by mysql <4.1
>>
>> i think we should and can not take care of this ...
>>
>>
>
> I'll continue my testing. I have the problem with PHP 5.1.0-dev of last
> week. Maybe we should at least give a warning to phpMyAdmin users. Let
> me talk to Georg about this.
>
> Marc
Ok, it looks like a PHP problem (seen at least in 5.1.0-dev). I have put
a workaround in mysqli.dbi.lib.php. The PHP problem itself is not
specific to MySQL 4.0.x and I reported it to Georg.
To reproduce:
<?php
$link = mysqli_init();
mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, TRUE);
$server_port = FALSE;
$server_socket = NULL;
$client_flags = 0;
$server = "";
$user = "";
$password = "";
mysqli_real_connect($link, $server, $user, $password, FALSE,
$server_port, $serv
er_socket, $client_flags);
mysqli_select_db($link, 'mysql');
$result = mysqli_query($link, 'SHOW FULL FIELDS FROM user',
MYSQLI_STORE_RESULT)
;
$fields_cnt = mysqli_num_rows($result);
echo '<pre>';
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo '<hr>';
print_r($row);
$num = mysqli_num_fields($result);
$fields = mysqli_fetch_fields($result);
if (is_array($fields)) {
echo '$fields is an array';
print_r($fields);
} else {
echo 'why $fields is not an array?';
}
}
echo '</pre>';
?>
========================
Now a question: in mysqli.dbi.lib.php, function
PMA_mysqli_fetch_array(), when this function is called by
function PMA_DBI_fetch_assoc($result) {
return PMA_mysqli_fetch_array($result, MYSQLI_ASSOC);
}
we only have ASSOC as a result, but in PMA_mysqli_fetch_array(), when we
need to convert, we are looking for $data[$i]. This seems wrong to me
in this case since we won't get numeric indices.
This is why my workaround avoids converting the data.
Marc
More information about the Developers
mailing list