Example #1
0
/**
 * Get HTML for ENGINE value not null or view tables that are not empty tables
 *
 * @param boolean $table_is_view  whether table is view
 * @param array   $current_table  current table
 * @param string  $collation      collation
 * @param boolean $is_show_stats  whether atats show or not
 * @param string  $tbl_url_query  table url query
 * @param string  $formatted_size formatted size
 * @param string  $unit           unit
 * @param string  $overhead       overhead
 * @param string  $create_time    create time
 * @param string  $update_time    update time
 * @param string  $check_time     check time
 *
 * @return string $html_output
 */
function PMA_getHtmlForNotNullEngineViewTable($table_is_view, $current_table, $collation, $is_show_stats, $tbl_url_query, $formatted_size, $unit, $overhead, $create_time, $update_time, $check_time)
{
    $html_output = '';
    $row_count_pre = '';
    $show_superscript = '';
    if ($table_is_view) {
        // Drizzle views use FunctionEngine, and the only place where they are
        // available are I_S and D_D schemas, where we do exact counting
        if ($current_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews'] && $current_table['ENGINE'] != 'FunctionEngine') {
            $row_count_pre = '~';
            $sum_row_count_pre = '~';
            $show_superscript = PMA_Util::showHint(PMA_sanitize(sprintf(__('This view has at least this number of rows. Please refer to %sdocumentation%s.'), '[doc@cfg_MaxExactCountViews]', '[/doc]')));
        }
    } elseif ($current_table['ENGINE'] == 'InnoDB' && !$current_table['COUNTED']) {
        // InnoDB table: we did not get an accurate row count
        $row_count_pre = '~';
        $sum_row_count_pre = '~';
        $show_superscript = '';
    }
    $html_output .= '<td class="value tbl_rows">' . $row_count_pre . PMA_Util::formatNumber($current_table['TABLE_ROWS'], 0) . $show_superscript . '</td>';
    if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
        $html_output .= '<td class="nowrap">' . ($table_is_view ? __('View') : $current_table['ENGINE']) . '</td>';
        if (strlen($collation)) {
            $html_output .= '<td class="nowrap">' . $collation . '</td>';
        }
    }
    if ($is_show_stats) {
        $html_output .= PMA_getHtmlForShowStats($tbl_url_query, $formatted_size, $unit, $overhead);
    }
    $html_output .= PMA_getHtmlForStructureTimes($create_time, $update_time, $check_time);
    return $html_output;
}
Example #2
0
/**
 * Get HTML for ENGINE value not null or view tables that are not empty tables
 *
 * @param boolean $table_is_view  whether table is view
 * @param array   $current_table  current table
 * @param string  $collation      collation
 * @param boolean $is_show_stats  whether stats show or not
 * @param string  $tbl_url_query  table url query
 * @param string  $formatted_size formatted size
 * @param string  $unit           unit
 * @param string  $overhead       overhead
 * @param string  $create_time    create time
 * @param string  $update_time    update time
 * @param string  $check_time     check time
 *
 * @return string $html_output
 */
function PMA_getHtmlForNotNullEngineViewTable($table_is_view, $current_table, $collation, $is_show_stats, $tbl_url_query, $formatted_size, $unit, $overhead, $create_time, $update_time, $check_time)
{
    $html_output = '';
    $row_count_pre = '';
    $show_superscript = '';
    if ($table_is_view) {
        // Drizzle views use FunctionEngine, and the only place where they are
        // available are I_S and D_D schemas, where we do exact counting
        if ($current_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews'] && $current_table['ENGINE'] != 'FunctionEngine') {
            $row_count_pre = '~';
            $show_superscript = PMA_Util::showHint(PMA_sanitize(sprintf(__('This view has at least this number of rows. Please refer to %sdocumentation%s.'), '[doc@cfg_MaxExactCountViews]', '[/doc]')));
        }
    } elseif ($current_table['ENGINE'] == 'InnoDB' && !$current_table['COUNTED']) {
        // InnoDB table: we did not get an accurate row count
        $row_count_pre = '~';
        $show_superscript = '';
    }
    // Set a flag if there are approximate row counts on page.
    if (!empty($row_count_pre)) {
        $approx_rows = true;
    } else {
        // this happens for information_schema, performance_schema,
        // and in case there is no InnoDB table on this page
        $approx_rows = false;
    }
    // Get the row count.
    $row_count = $row_count_pre . PMA_Util::formatNumber($current_table['TABLE_ROWS'], 0);
    // URL parameters to fetch the real row count.
    $real_count_url = array('ajax_request' => true, 'db' => $GLOBALS['db'], 'table' => $current_table['TABLE_NAME'], 'real_row_count' => 'true');
    // Content to be appended into 'tbl_rows' cell.
    // If row count is approximate, display it as an anchor to get real count.
    $cell_text = !empty($row_count_pre) ? '<a href="db_structure.php' . PMA_URL_getCommon($real_count_url) . '" class="ajax real_row_count">' . $row_count . '</a>' : $row_count;
    $html_output .= '<td class="value tbl_rows" data-table="' . htmlspecialchars($current_table['TABLE_NAME']) . '">' . $cell_text . $show_superscript . '</td>';
    if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
        $html_output .= '<td class="nowrap">' . (!empty($current_table['ENGINE']) ? $current_table['ENGINE'] : ($table_is_view ? __('View') : '')) . '</td>';
        if (mb_strlen($collation)) {
            $html_output .= '<td class="nowrap">' . $collation . '</td>';
        }
    }
    if ($is_show_stats) {
        $html_output .= PMA_getHtmlForShowStats($tbl_url_query, $formatted_size, $unit, $overhead);
    }
    $html_output .= PMA_getHtmlForStructureTimes($create_time, $update_time, $check_time);
    return array($html_output, $approx_rows);
}