$tbl_type = $GLOBALS['strView']; $show_comment = null; } else { $tbl_is_view = false; $tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : ''; // a new comment could be coming from tbl_properties_operations.php // and we want to show it in the header if (isset($submitcomment) && isset($comment)) { $show_comment = $comment; } else { $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : ''; } } $tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation']; if (null === $showtable['Rows']) { $showtable['Rows'] = PMA_countRecords($GLOBALS['db'], $showtable['Name'], true, true); } $table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0; $auto_increment = isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : ''; $create_options = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array(); // export create options by its name as variables into gloabel namespace // f.e. pack_keys=1 becomes available as $pack_keys with value of '1' foreach ($create_options as $each_create_option) { $each_create_option = explode('=', $each_create_option); if (isset($each_create_option[1])) { ${$each_create_option}[0] = $each_create_option[1]; } } unset($create_options, $each_create_option); } // end if
/** * Defines the display mode to use for the results of a sql query * * It uses a synthetic string that contains all the required informations. * In this string: * - the first two characters stand for the action to do while * clicking on the "edit" link (eg 'ur' for update a row, 'nn' for no * edit link...); * - the next two characters stand for the action to do while * clicking on the "delete" link (eg 'kp' for kill a process, 'nn' for * no delete link...); * - the next characters are boolean values (1/0) and respectively stand * for sorting links, navigation bar, "insert a new row" link, the * bookmark feature, the expand/collapse text/blob fields button and * the "display printable view" option. * Of course '0'/'1' means the feature won't/will be enabled. * * @param string the synthetic value for display_mode (see §1 a few * lines above for explanations) * @param integer the total number of rows returned by the sql query * without any programmatically appended "LIMIT" clause * (just a copy of $unlim_num_rows if it exists, else * computed inside this function) * * @return array an array with explicit indexes for all the display * elements * * @global string the database name * @global string the table name * @global integer the total number of rows returned by the sql query * without any programmatically appended "LIMIT" clause * @global array the properties of the fields returned by the query * @global string the url to return to in case of error in a sql * statement * * @access private * * @see PMA_displayTable() */ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) { global $db, $table; global $unlim_num_rows, $fields_meta; global $err_url; // 1. Initializes the $do_display array $do_display = array(); $do_display['edit_lnk'] = $the_disp_mode[0] . $the_disp_mode[1]; $do_display['del_lnk'] = $the_disp_mode[2] . $the_disp_mode[3]; $do_display['sort_lnk'] = (string) $the_disp_mode[4]; $do_display['nav_bar'] = (string) $the_disp_mode[5]; $do_display['ins_row'] = (string) $the_disp_mode[6]; $do_display['bkm_form'] = (string) $the_disp_mode[7]; $do_display['text_btn'] = (string) $the_disp_mode[8]; $do_display['pview_lnk'] = (string) $the_disp_mode[9]; // 2. Display mode is not "false for all elements" -> updates the // display mode if ($the_disp_mode != 'nnnn000000') { // 2.0 Print view -> set all elements to FALSE! if (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1') { $do_display['edit_lnk'] = 'nn'; // no edit link $do_display['del_lnk'] = 'nn'; // no delete link $do_display['sort_lnk'] = (string) '0'; $do_display['nav_bar'] = (string) '0'; $do_display['ins_row'] = (string) '0'; $do_display['bkm_form'] = (string) '0'; $do_display['text_btn'] = (string) '0'; $do_display['pview_lnk'] = (string) '0'; } else { if ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) { $do_display['edit_lnk'] = 'nn'; // no edit link $do_display['del_lnk'] = 'nn'; // no delete link $do_display['sort_lnk'] = (string) '0'; $do_display['nav_bar'] = (string) '0'; $do_display['ins_row'] = (string) '0'; $do_display['bkm_form'] = (string) '1'; if ($GLOBALS['is_analyse']) { $do_display['text_btn'] = (string) '1'; } else { $do_display['text_btn'] = (string) '0'; } $do_display['pview_lnk'] = (string) '1'; } else { if ($GLOBALS['is_show']) { // 2.2.1 TODO : defines edit/delete links depending on show statement $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which); if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) { $do_display['edit_lnk'] = 'nn'; // no edit link $do_display['del_lnk'] = 'kp'; // "kill process" type edit link } else { // Default case -> no links $do_display['edit_lnk'] = 'nn'; // no edit link $do_display['del_lnk'] = 'nn'; // no delete link } // 2.2.2 Other settings $do_display['sort_lnk'] = (string) '0'; $do_display['nav_bar'] = (string) '0'; $do_display['ins_row'] = (string) '0'; $do_display['bkm_form'] = (string) '1'; $do_display['text_btn'] = (string) '1'; $do_display['pview_lnk'] = (string) '1'; } else { $prev_table = $fields_meta[0]->table; $do_display['text_btn'] = (string) '1'; for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) { $is_link = $do_display['edit_lnk'] != 'nn' || $do_display['del_lnk'] != 'nn' || $do_display['sort_lnk'] != '0' || $do_display['ins_row'] != '0'; // 2.3.2 Displays edit/delete/sort/insert links? if ($is_link && ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table)) { $do_display['edit_lnk'] = 'nn'; // don't display links $do_display['del_lnk'] = 'nn'; // TODO: May be problematic with same fields names in // two joined table. // $do_display['sort_lnk'] = (string) '0'; $do_display['ins_row'] = (string) '0'; if ($do_display['text_btn'] == '1') { break; } } // end if (2.3.2) // 2.3.3 Always display print view link $do_display['pview_lnk'] = (string) '1'; $prev_table = $fields_meta[$i]->table; } // end for } } } // end if..elseif...else (2.1 -> 2.3) } // end if (2) // 3. Gets the total number of rows if it is unknown if (isset($unlim_num_rows) && $unlim_num_rows != '') { $the_total = $unlim_num_rows; } else { if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') && (!empty($db) && !empty($table))) { $the_total = PMA_countRecords($db, $table, TRUE); } } // 4. If navigation bar or sorting fields names urls should be // displayed but there is only one row, change these settings to // false if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') { if (isset($unlim_num_rows) && $unlim_num_rows < 2) { // garvin: force display of navbar for vertical/horizontal display-choice. // $do_display['nav_bar'] = (string) '0'; $do_display['sort_lnk'] = (string) '0'; } } // end if (3) // 5. Updates the synthetic var $the_disp_mode = join('', $do_display); return $do_display; }
*/ // lem9: we always show the foreign field in the drop-down; if a display // field is defined, we show it besides the foreign field $foreign_link = false; if ($foreigners && isset($foreigners[$field])) { $foreigner = $foreigners[$field]; $foreign_db = $foreigner['foreign_db']; $foreign_table = $foreigner['foreign_table']; $foreign_field = $foreigner['foreign_field']; // Count number of rows in the foreign table. Currently we do // not use a drop-down if more than 200 rows in the foreign table, // for speed reasons and because we need a better interface for this. // // We could also do the SELECT anyway, with a LIMIT, and ensure that // the current value of the field is one of the choices. $the_total = PMA_countRecords($foreign_db, $foreign_table, TRUE); if (isset($override_total) && $override_total == true || $the_total < 200) { // foreign_display can be FALSE if no display field defined: $foreign_display = PMA_getDisplayField($foreign_db, $foreign_table); $dispsql = 'SELECT ' . PMA_backquote($foreign_field) . ($foreign_display == FALSE ? '' : ', ' . PMA_backquote($foreign_display)) . ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table) . ($foreign_display == FALSE ? '' : ' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display)) . (isset($foreign_limit) ? $foreign_limit : ''); $disp = PMA_DBI_query($dispsql); if ($disp) { // garvin: If a resultset has been created, pre-cache it in the $disp_row array // This helps us from not needing to use mysql_data_seek by accessing a pre-cached // PHP array. Usually those resultsets are not that big, so a performance hit should // not be expected. $disp_row = array(); while ($single_disp_row = @PMA_DBI_fetch_assoc($disp)) { $disp_row[] = $single_disp_row; } @PMA_DBI_free_result($disp);
<tr> <td bgcolor="<?php echo $bgcolor; ?> " nowrap="nowrap"> <b><?php echo htmlspecialchars($tables[$i]); ?> </b> </td> <td align="right" bgcolor="<?php echo $bgcolor; ?> " nowrap="nowrap"> <?php PMA_countRecords($db, $tables[$i]); ?> </td> </tr> <?php $i++; } // end while echo "\n"; ?> </table> <?php } } // end if /**
show_checked_option(); //--> </script> </td> </tr> <?php if (isset($table) && !empty($table) && !isset($num_tables)) { ?> <tr> <td colspan="3" align="center"> <div style="background-color: <?php echo $cfg['BgcolorOne']; ?> ; padding: 3px; margin: 1px;"> <b><?php echo sprintf($strDumpXRows, '<input type="text" name="limit_to" size="5" value="' . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_countRecords($db, $table, TRUE)) . '" class="textfield" style="vertical-align: middle" onfocus="this.select()" style="vertical-align: middle; text-align: center;" />', '<input type="text" name="limit_from" value="0" size="5" class="textfield" style="vertical-align: middle" onfocus="this.select()" style="vertical-align: middle; text-align: center;" />') . "\n"; ?> </b> </div> </td> </tr> <?php } ?> <tr> <!-- Export to screen or to file --> <td colspan="3"> <table width="100%" border="0" cellpadding="3" cellspacing="1"> <tr> <th align="left">
} else { $col_cand = $sg; // None of the candidates where in a where-clause } } // If our array of candidates has more than one member we'll just // find the smallest table. // Of course the actual query would be faster if we check for // the Criteria which gives the smallest result set in its table, // but it would take too much time to check this if (count($col_cand) > 1) { // Of course we only want to check each table once $checked_tables = $col_cand; foreach ($col_cand as $tab) { if ($checked_tables[$tab] != 1) { $tsize[$tab] = PMA_countRecords($db, $tab, true, false); $checked_tables[$tab] = 1; } $csize[$tab] = $tsize[$tab]; } asort($csize); reset($csize); $master = key($csize); // Smallest } else { reset($col_cand); $master = current($col_cand); // Only one single candidate } } // end if (exactly one where clause)
?> </td> </tr> <tr> <td colspan="2"> <?php echo $strStartingRecord; ?> <input type="text" name="limit_from" value="0" size="5" class="textfield" style="vertical-align: middle" onfocus="this.select()" /> -- <?php echo $strNbRecords; ?> <input type="text" name="limit_to" size="5" value="<?php echo PMA_countRecords($db, $table, TRUE); ?> " class="textfield" style="vertical-align: middle" onfocus="this.select()" /> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" value="<?php echo $strGo; ?> " /> </td> </tr> </table> </form> </li>
echo urlencode('DELETE FROM ' . PMA_backquote($table)); ?> &zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, $table_name)); ?> "><?php echo $strEmpty; ?> </a> </td> <td align="right" bgcolor="<?php echo $bgcolor; ?> "> <?php PMA_countRecords($db, $table); echo "\n"; ?> </td> </tr> <?php $i++; } // end while echo "\n"; // Check all tables url $checkall_url = 'db_details.php' . '?lang=' . $lang . '&server=' . $server . '&db=' . urlencode($db); ?> <tr> <td colspan="9"> <img src="./images/arrow_<?php
<form method="post" action="db_details_structure.php" name="tablesForm" id="tablesForm"> <?php echo PMA_generate_common_hidden_inputs($db); PMA_TableHeader($db_is_information_schema); $i = $sum_entries = 0; $sum_size = (double) 0; $overhead_size = (double) 0; $overhead_check = ''; $checked = !empty($checkall) ? ' checked="checked"' : ''; $num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0; $row_count = 0; $hidden_fields = array(); $odd_row = true; foreach ($tables as $keyname => $each_table) { if ($each_table['TABLE_ROWS'] === NULL || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) { $each_table['TABLE_ROWS'] = PMA_countRecords($db, $each_table['TABLE_NAME'], $return = true, $force_exact = true); } $table_encoded = urlencode($each_table['TABLE_NAME']); // MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW" $table_is_view = $each_table['TABLE_TYPE'] === 'VIEW' || $each_table['TABLE_TYPE'] === 'SYSTEM VIEW'; $alias = !empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']]) ? htmlspecialchars($tooltip_aliasname[$each_table['TABLE_NAME']]) : htmlspecialchars($each_table['TABLE_NAME']); $truename = !empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']]) ? htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']]) : htmlspecialchars($each_table['TABLE_NAME']); // Sets parameters for links $tbl_url_query = $url_query . '&table=' . $table_encoded; $i++; $row_count++; if ($table_is_view) { $hidden_fields[] = '<input type="hidden" name="views[]" value="' . $table_encoded . '" />'; } if ($each_table['TABLE_ROWS'] > 0) { $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($each_table['TABLE_NAME']) . '\'', 'label');
if (empty($sql_limit_to_append)) { $unlim_num_rows = $num_rows; // if we did not append a limit, set this to get a correct // "Showing rows..." message $GLOBALS['session_max_rows'] = 'all'; } else { if ($is_select) { // c o u n t q u e r y // If we are "just browsing", there is only one table, // and no where clause (or just 'WHERE 1 '), // so we do a quick count (which uses MaxExactCount) // because SQL_CALC_FOUND_ROWS // is not quick on large InnoDB tables if (!$is_group && !isset($analyzed_sql[0]['queryflags']['union']) && !isset($analyzed_sql[0]['table_ref'][1]['table_name']) && (empty($analyzed_sql[0]['where_clause']) || $analyzed_sql[0]['where_clause'] == '1 ')) { // "j u s t b r o w s i n g" $unlim_num_rows = PMA_countRecords($db, $table, TRUE); } else { // n o t " j u s t b r o w s i n g " if (PMA_MYSQL_INT_VERSION < 40000) { // detect this case: // SELECT DISTINCT x AS foo, y AS bar FROM sometable if (isset($analyzed_sql[0]['queryflags']['distinct'])) { $count_what = 'DISTINCT '; $first_expr = TRUE; foreach ($analyzed_sql[0]['select_expr'] as $part) { $count_what .= (!$first_expr ? ', ' : '') . $part['expr']; $first_expr = FALSE; } } else { $count_what = '*'; }
$tbl_type = $strView; $show_comment = NULL; } else { $tbl_is_view = FALSE; $tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : ''; // a new comment could be coming from tbl_properties_operations.php // and we want to show it in the header if (isset($submitcomment) && isset($comment)) { $show_comment = $comment; } else { $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : ''; } } $tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation']; if (NULL === $showtable['Rows']) { $showtable['Rows'] = PMA_countRecords($GLOBALS['db'], $showtable['Name'], $return = true, $force_exact = true); } $table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0; $auto_increment = isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : ''; $tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array(); $tmp_cnt = count($tmp); for ($i = 0; $i < $tmp_cnt; $i++) { $tmp1 = explode('=', $tmp[$i]); if (isset($tmp1[1])) { ${$tmp1}[0] = $tmp1[1]; } } // end for PMA_DBI_free_result($table_info_result); unset($tmp1, $tmp, $table_info_result); }
?> <input type="hidden" name="xml_data" value="xml_data" /> </fieldset> <script type="text/javascript"> <!-- show_checked_option(); //--> </script> <?php if (!empty($table) && !isset($num_tables)) { ?> <div class="formelementrow"> <?php echo sprintf($strDumpXRows, '<input type="text" name="limit_to" size="5" value="' . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_countRecords($db, $table, TRUE)) . '" onfocus="this.select()" />', '<input type="text" name="limit_from" value="0" size="5"' . ' onfocus="this.select()" /> '); ?> </div> <?php } ?> </fieldset> <fieldset> <legend> <input type="checkbox" name="asfile" value="sendit" id="checkbox_dump_asfile" <?php PMA_exportCheckboxCheck('asfile'); ?> /> <label for="checkbox_dump_asfile"><?php
/** * returns array with tables of given db with extended infomation and grouped * * @uses $GLOBALS['cfg']['LeftFrameTableSeparator'] * @uses $GLOBALS['cfg']['LeftFrameTableLevel'] * @uses $GLOBALS['cfg']['ShowTooltipAliasTB'] * @uses $GLOBALS['cfg']['NaturalOrder'] * @uses PMA_DBI_fetch_result() * @uses PMA_backquote() * @uses count() * @uses array_merge * @uses uksort() * @uses strstr() * @uses explode() * @param string $db name of db * return array (rekursive) grouped table list */ function PMA_getTableList($db) { $sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; $tables = PMA_DBI_get_tables_full($db); if (count($tables) < 1) { return $tables; } if ($GLOBALS['cfg']['NaturalOrder']) { uksort($tables, 'strcmp'); } $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => ''); $table_groups = array(); foreach ($tables as $table_name => $table) { // check for correct row count if (NULL === $table['Rows']) { $table['Rows'] = PMA_countRecords($db, $table['Name'], $return = true, $force_exact = true); } // in $group we save the reference to the place in $table_groups // where to store the table info if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) { $parts = explode($sep, $table_name); $group =& $table_groups; $i = 0; $group_name_full = ''; while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) { $group_name = $parts[$i] . $sep; $group_name_full .= $group_name; if (!isset($group[$group_name])) { $group[$group_name] = array(); $group[$group_name]['is' . $sep . 'group'] = true; $group[$group_name]['tab' . $sep . 'count'] = 1; $group[$group_name]['tab' . $sep . 'group'] = $group_name_full; } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) { $table = $group[$group_name]; $group[$group_name] = array(); $group[$group_name][$group_name] = $table; unset($table); $group[$group_name]['is' . $sep . 'group'] = true; $group[$group_name]['tab' . $sep . 'count'] = 1; $group[$group_name]['tab' . $sep . 'group'] = $group_name_full; } else { $group[$group_name]['tab_count']++; } $group =& $group[$group_name]; $i++; } } else { if (!isset($table_groups[$table_name])) { $table_groups[$table_name] = array(); } $group =& $table_groups; } if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') { // switch tooltip and name $table['Comment'] = $table['Name']; $table['disp_name'] = $table['Comment']; } else { $table['disp_name'] = $table['Name']; } $group[$table_name] = array_merge($default, $table); } return $table_groups; }
/** * returns array with tables of given db with extended infomation and grouped * * @uses $GLOBALS['cfg']['LeftFrameTableSeparator'] * @uses $GLOBALS['cfg']['LeftFrameTableLevel'] * @uses $GLOBALS['cfg']['ShowTooltipAliasTB'] * @uses $GLOBALS['cfg']['NaturalOrder'] * @uses PMA_DBI_fetch_result() * @uses PMA_backquote() * @uses count() * @uses array_merge * @uses uksort() * @uses strstr() * @uses explode() * @param string $db name of db * return array (rekursive) grouped table list */ function PMA_getTableList($db, $tables = null) { $sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; if (null === $tables) { $tables = PMA_DBI_get_tables_full($db); if ($GLOBALS['cfg']['NaturalOrder']) { uksort($tables, 'strnatcasecmp'); } } if (count($tables) < 1) { return $tables; } $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => ''); $table_groups = array(); foreach ($tables as $table_name => $table) { // check for correct row count if (null === $table['Rows']) { // Do not check exact row count here, // if row count is invalid possibly the table is defect // and this would break left frame; // but we can check row count if this is a view, // since PMA_countRecords() returns a limited row count // in this case. // set this because PMA_countRecords() can use it $tbl_is_view = PMA_tableIsView($db, $table['Name']); if ($tbl_is_view) { $table['Rows'] = PMA_countRecords($db, $table['Name'], $return = true); } } // in $group we save the reference to the place in $table_groups // where to store the table info if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) { $parts = explode($sep, $table_name); $group =& $table_groups; $i = 0; $group_name_full = ''; while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) { $group_name = $parts[$i] . $sep; $group_name_full .= $group_name; if (!isset($group[$group_name])) { $group[$group_name] = array(); $group[$group_name]['is' . $sep . 'group'] = true; $group[$group_name]['tab' . $sep . 'count'] = 1; $group[$group_name]['tab' . $sep . 'group'] = $group_name_full; } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) { $table = $group[$group_name]; $group[$group_name] = array(); $group[$group_name][$group_name] = $table; unset($table); $group[$group_name]['is' . $sep . 'group'] = true; $group[$group_name]['tab' . $sep . 'count'] = 1; $group[$group_name]['tab' . $sep . 'group'] = $group_name_full; } else { $group[$group_name]['tab' . $sep . 'count']++; } $group =& $group[$group_name]; $i++; } } else { if (!isset($table_groups[$table_name])) { $table_groups[$table_name] = array(); } $group =& $table_groups; } if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') { // switch tooltip and name $table['Comment'] = $table['Name']; $table['disp_name'] = $table['Comment']; } else { $table['disp_name'] = $table['Name']; } $group[$table_name] = array_merge($default, $table); } return $table_groups; }
$unlim_num_rows = $num_rows; // if we did not append a limit, set this to get a correct // "Showing rows..." message $GLOBALS['session_max_rows'] = 'all'; } elseif ($is_select) { // c o u n t q u e r y // If we are "just browsing", there is only one table, // and no where clause (or just 'WHERE 1 '), // so we do a quick count (which uses MaxExactCount) // because SQL_CALC_FOUND_ROWS // is not quick on large InnoDB tables // but do not count again if we did it previously // due to $find_real_end == true if (!$is_group && !isset($analyzed_sql[0]['queryflags']['union']) && !isset($analyzed_sql[0]['table_ref'][1]['table_name']) && (empty($analyzed_sql[0]['where_clause']) || $analyzed_sql[0]['where_clause'] == '1 ') && !isset($find_real_end)) { // "j u s t b r o w s i n g" $unlim_num_rows = PMA_countRecords($db, $table, true); } else { // n o t " j u s t b r o w s i n g " if (PMA_MYSQL_INT_VERSION < 40000) { // detect this case: // SELECT DISTINCT x AS foo, y AS bar FROM sometable if (isset($analyzed_sql[0]['queryflags']['distinct'])) { $count_what = 'DISTINCT '; $first_expr = true; foreach ($analyzed_sql[0]['select_expr'] as $part) { $count_what .= (!$first_expr ? ', ' : '') . $part['expr']; $first_expr = false; } } else { $count_what = '*'; }