Fix grabing indexes with MYSQLI_USE_RESULT (bug #1007286).

This commit is contained in:
Michal Čihař
2004-08-11 15:12:29 +00:00
parent 2c9c750fc0
commit 1de0157813
3 changed files with 22 additions and 19 deletions

View File

@@ -7,7 +7,10 @@ $Source$
2004-08-11 Michal Čihař <michal@cihar.com>
* tbl_replace.php: Do not empty protected values (bug #1006812).
* libraries/display_tbl.lib.php: Wrong parameters for PMA_DBI_free_result (bug #1007287).
* libraries/display_tbl.lib.php: Wrong parameters for PMA_DBI_free_result
(bug #1007287).
* tbl_indexes.php, libraries/display_tbl.lib.php: Fix grabing indexes with
MYSQLI_USE_RESULT (bug #1007286).
2004-08-10 Michal Čihař <michal@cihar.com>
* libraries/tbl_change.js: Forcibily use 10 as base for parsed numbers,

View File

@@ -489,12 +489,18 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
$sort_expression_nodir = isset($matches[1]) ? trim($matches[1]) : $sort_expression;
// grab indexes data:
$result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
$idx_cnt = PMA_DBI_num_rows($result);
if (!defined('PMA_IDX_INCLUDED')) {
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
$result = PMA_DBI_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$ret_keys = array();
while ($row = PMA_DBI_fetch_assoc($result)) {
$ret_keys[] = $row;
}
PMA_DBI_free_result($result);
}
$prev_index = '';
for ($i = 0; $i < $idx_cnt; $i++) {
$row = (defined('PMA_IDX_INCLUDED') ? $ret_keys[$i] : PMA_DBI_fetch_assoc($result));
foreach ($ret_keys as $row) {
if ($row['Key_name'] != $prev_index ){
$indexes[] = $row['Key_name'];

View File

@@ -66,17 +66,17 @@ $prev_index = '';
$indexes_info = array();
$indexes_data = array();
// keys had already been grabbed in "tbl_properties.php"
if (defined('PMA_IDX_INCLUDED')) {
$idx_cnt = count($ret_keys);
} else {
if (!defined('PMA_IDX_INCLUDED')) {
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
$result = PMA_DBI_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
$idx_cnt = PMA_DBI_num_rows($result);
$ret_keys = array();
while ($row = PMA_DBI_fetch_assoc($result)) {
$ret_keys[] = $row;
}
PMA_DBI_free_result($result);
}
for ($i = 0; $i < $idx_cnt; $i++) {
$row = (defined('PMA_IDX_INCLUDED') ? $ret_keys[$i] : PMA_DBI_fetch_assoc($result));
foreach ($ret_keys as $row) {
if ($row['Key_name'] != $prev_index ){
$indexes[] = $row['Key_name'];
$prev_index = $row['Key_name'];
@@ -101,12 +101,6 @@ for ($i = 0; $i < $idx_cnt; $i++) {
}
} // end while
if (defined('PMA_IDX_INCLUDED')) {
unset($ret_keys);
} else if ($result) {
PMA_DBI_free_result($result);
}
// Get fields and stores their name/type
// fields had already been grabbed in "tbl_properties.php"
if (!defined('PMA_IDX_INCLUDED')) {
@@ -427,7 +421,7 @@ else if (!defined('PMA_IDX_INCLUDED')
$drop_link_text = '<nobr>' . $drop_link_text . '</nobr>';
}
if ($idx_cnt > 0) {
if (count($ret_keys) > 0) {
?>
<!--table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1"-->
<tr>