bug #1253453, using mysqli extension with MySQL 4.0.x

This commit is contained in:
Marc Delisle
2005-08-08 14:57:05 +00:00
parent f075f90574
commit 5b081dabb8
2 changed files with 32 additions and 8 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-08-08 Marc Delisle <lem9@users.sourceforge.net>
* libraries/dbi/mysqli.dbi.lib.php: bug #1253453, using mysqli extension
with MySQL 4.0.x
2005-08-07 Marc Delisle <lem9@users.sourceforge.net> 2005-08-07 Marc Delisle <lem9@users.sourceforge.net>
* Documentation.html: Save button for PDF schema coordinates, * Documentation.html: Save button for PDF schema coordinates,
thanks to Ryan Schmidt thanks to Ryan Schmidt

View File

@@ -141,21 +141,35 @@ function PMA_mysqli_fetch_array($result, $type = FALSE) {
} else { } else {
$ret = array(); $ret = array();
$num = mysqli_num_fields($result); $num = mysqli_num_fields($result);
$fields = mysqli_fetch_fields($result); if ($num > 0) {
$fields = PMA_DBI_get_fields_meta($result);
}
$i = 0; $i = 0;
for ($i = 0; $i < $num; $i++) { for ($i = 0; $i < $num; $i++) {
if (!$meta) { if (!isset($fields[$i]->type)) {
/* No meta information available -> we guess that it should be converted */ /* No meta information available -> we guess that it should be converted */
if (isset($data[$i])) $ret[$i] = PMA_convert_display_charset($data[$i]); if (isset($data[$i])) {
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]); $ret[$i] = PMA_convert_display_charset($data[$i]);
}
if (isset($fields[$i]->name) && isset($data[$fields[$i]->name])) {
$ret[PMA_convert_display_charset($fields[$i]->name)] = PMA_convert_display_charset($data[$fields[$i]->name]);
}
} else { } else {
/* Meta information available -> check type of field and convert it according to the type */ /* Meta information available -> check type of field and convert it according to the type */
if (stristr($fields[$i]->type, 'BLOB') || stristr($fields[$i]->type, 'BINARY')) { if (stristr($fields[$i]->type, 'BLOB') || stristr($fields[$i]->type, 'BINARY')) {
if (isset($data[$i])) $ret[$i] = $data[$i]; if (isset($data[$i])) {
if (isset($data[$fields[$i]->name])) $ret[PMA_convert_display_charset($fields[$i]->name)] = $data[$fields[$i]->name]; $ret[$i] = $data[$i];
}
if (isset($data[$fields[$i]->name])) {
$ret[PMA_convert_display_charset($fields[$i]->name)] = $data[$fields[$i]->name];
}
} else { } else {
if (isset($data[$i])) $ret[$i] = PMA_convert_display_charset($data[$i]); if (isset($data[$i])) {
if (isset($data[$fields[$i]->name])) $ret[PMA_convert_display_charset($fields[$i]->name)] = PMA_convert_display_charset($data[$fields[$i]->name]); $ret[$i] = PMA_convert_display_charset($data[$i]);
}
if (isset($data[$fields[$i]->name])) {
$ret[PMA_convert_display_charset($fields[$i]->name)] = PMA_convert_display_charset($data[$fields[$i]->name]);
}
} }
} }
} }
@@ -293,6 +307,12 @@ function PMA_DBI_get_fields_meta($result) {
$typeAr[MYSQLI_TYPE_GEOMETRY] = 'unknown'; $typeAr[MYSQLI_TYPE_GEOMETRY] = 'unknown';
$fields = mysqli_fetch_fields($result); $fields = mysqli_fetch_fields($result);
// this happens sometimes (seen under MySQL 4.0.25)
if (!is_array($fields)) {
return FALSE;
}
foreach ($fields as $k => $field) { foreach ($fields as $k => $field) {
$fields[$k]->type = $typeAr[$fields[$k]->type]; $fields[$k]->type = $typeAr[$fields[$k]->type];
$fields[$k]->flags = PMA_DBI_field_flags($result, $k); $fields[$k]->flags = PMA_DBI_field_flags($result, $k);