0 || $table_is_view) { $may_have_rows = true; } else { $may_have_rows = false; } $browse_table = ''; if ($may_have_rows) { $browse_table .= $titles['Browse']; } else { $browse_table .= $titles['NoBrowse']; } $browse_table .= ''; $search_table = ''; if ($may_have_rows) { $search_table .= $titles['Search']; } else { $search_table .= $titles['NoSearch']; } $search_table .= ''; $browse_table_label = '' . $truename . ''; if (!$db_is_information_schema) { $empty_table = 'backquote($current_table['TABLE_NAME']) ) . '&message_to_show=' . urlencode( sprintf(__('Table %s has been emptied'), htmlspecialchars($current_table['TABLE_NAME'])) ) . '">'; if ($may_have_rows) { $empty_table .= $titles['Empty']; } else { $empty_table .= $titles['NoEmpty']; } $empty_table .= ''; // truncating views doesn't work if ($table_is_view) { $empty_table = ' '; } } $tracking_icon = ''; if (PMA_Tracker::isActive()) { if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { $tracking_icon = '' . $common_functions->getImage( 'eye.png', __('Tracking is active.') ) . ''; } elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { $tracking_icon = '' . $common_functions->getImage( 'eye.png', __('Tracking is not active.') ) . ''; } } return array($browse_table, $search_table, $browse_table_label, $empty_table, $tracking_icon ); } /** * Get table drop query and drop message * * @param boolean $table_is_view Is table view or not * @param string $current_table current table * * @return array ($drop_query, $drop_message) */ function PMA_getTableDropQueryAndMessage($table_is_view, $current_table) { $drop_query = 'DROP ' . (($table_is_view || $current_table['ENGINE'] == null) ? 'VIEW' : 'TABLE') . ' ' . PMA_CommonFunctions::getInstance()->backquote( $current_table['TABLE_NAME'] ); $drop_message = sprintf( ($table_is_view || $current_table['ENGINE'] == null) ? __('View %s has been dropped') : __('Table %s has been dropped'), str_replace( ' ', ' ', htmlspecialchars($current_table['TABLE_NAME']) ) ); return array($drop_query, $drop_message); } /** * Get HTML body for table summery * * @param integer $num_tables number of tables * @param boolean $server_slave_status server slave state * @param boolean $db_is_information_schema whether database is information schema or not * @param integer $sum_entries sum entries * @param string $db_collation collation of given db * @param boolean $is_show_stats whether stats is show or not * @param double $sum_size sum size * @param double $overhead_size overhead size * @param string $create_time_all create time * @param string $update_time_all update time * @param string $check_time_all check time * @param integer $sum_row_count_pre sum row count pre * * @return string $html_output */ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, $db_is_information_schema, $sum_entries, $db_collation, $is_show_stats, $sum_size, $overhead_size, $create_time_all, $update_time_all, $check_time_all, $sum_row_count_pre ) { $common_functions = PMA_CommonFunctions::getInstance(); if ($is_show_stats) { list($sum_formatted, $unit) = $common_functions->formatByteDown( $sum_size, 3, 1 ); list($overhead_formatted, $overhead_unit) = $common_functions->formatByteDown($overhead_size, 3, 1); } $html_output = '' . ''; $html_output .= ''; $html_output .= sprintf( _ngettext('%s table', '%s tables', $num_tables), $common_functions->formatNumber($num_tables, 0) ); $html_output .= ''; if ($server_slave_status) { $html_output .= '' . __('Replication') . '' . "\n"; } $html_output .= '' . __('Sum') . ''; $html_output .= '' . $sum_row_count_pre . $common_functions->formatNumber($sum_entries, 0) . ''; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { $default_engine = PMA_DBI_fetch_value( 'SHOW VARIABLES LIKE \'storage_engine\';', 0, 1 ); $html_output .= '' . "\n" . '' .$default_engine . '' . "\n"; // we got a case where $db_collation was empty $html_output .= '' . "\n"; if (! empty($db_collation)) { $html_output .= '' . $db_collation . ''; } $html_output .= ''; } if ($is_show_stats) { $html_output .= '' . $sum_formatted . ' ' . $unit . ''; $html_output .= '' . $overhead_formatted . ' ' . $overhead_unit . ''; } if ($GLOBALS['cfg']['ShowDbStructureCreation']) { $html_output .= '' . "\n" . ' ' . ($create_time_all ? $common_functions->localisedDate(strtotime($create_time_all)) : '-' ) . ''; } if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { $html_output .= '' . "\n" . ' ' . ($update_time_all ? $common_functions->localisedDate(strtotime($update_time_all)) : '-' ) . ''; } if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { $html_output .= '' . "\n" . ' ' . ($check_time_all ? $common_functions->localisedDate(strtotime($check_time_all)) : '-' ) . ''; } $html_output .= '' . ''; return $html_output; } /** * Get HTML for "check all" check box with "with selected" dropdown * * @param string $pmaThemeImage pma theme image url * @param string $text_dir url for text directory * @param string $overhead_check overhead check * @param boolean $db_is_information_schema whether database is information schema or not * @param string $hidden_fields hidden fields * * @return string $html_output */ function PMA_getHtmlForCheckAllTables($pmaThemeImage, $text_dir, $overhead_check, $db_is_information_schema, $hidden_fields ) { $html_output = '
'; $html_output .= '' . __('With selected:') . ''; $html_output .= ''; $html_output .= ''; if ($overhead_check != '') { $html_output .= '/'; $html_output .= '' . __('Check tables having overhead') . ''; } $html_output .= '' . implode("\n", $hidden_fields) . "\n"; $html_output .= '
'; return $html_output; } /** * Get HTML links for "Print view" and "Data Dictionary" options * * @param string $url_query url query * * @return string $html_output */ function PMA_getHtmlForPrintViewAndDataDictionaryLinks($url_query) { $common_functions = PMA_CommonFunctions::getInstance(); $html_output = '

' . '' . $common_functions->getIcon( 'b_print.png', __('Print view'), true ) . ''; $html_output .= '' . $common_functions->getIcon( 'b_tblanalyse.png', __('Data Dictionary'), true ) . '' . '

'; return $html_output; } /** * Get Time for Create time, update time and check time * * @param array $current_table current table * @param string $time_label Create_time, Update_time, Check_time * @param integer $time_all time * * @return array ($time, $time_all) */ function PMA_getTimeForCreateUpdateCheck($current_table, $time_label, $time_all) { $showtable = PMA_Table::sGetStatusInfo( $GLOBALS['db'], $current_table['TABLE_NAME'], null, true ); $time = isset($showtable[$time_label]) ? $showtable[$time_label] : false; // show oldest creation date in summary row if ($time && (!$time_all || $time < $time_all)) { $time_all = $time; } return array($time, $time_all); } /** * Get HTML for each table row of the database structure table * * @param integer $curr current entry * @param boolean $odd_row whether row is odd or not * @param boolean $table_is_view whether table is view or not * @param array $current_table current table * @param string $checked checked attribute * @param string $browse_table_label browse table label action link * @param string $tracking_icon tracking icon * @param boolean $server_slave_status server slave state * @param string $browse_table browse table action link * @param string $tbl_url_query table url query * @param string $search_table search table action link * @param boolean $db_is_information_schema whether db is information schema or not * @param array $titles titles array * @param string $empty_table empty table action link * @param string $drop_query table dropt query * @param string $drop_message table drop message * @param string $collation collation * @param string $formatted_size formatted size * @param string $unit unit * @param string $overhead overhead * @param string $create_time create time * @param string $update_time last update time * @param string $check_time last check time * @param boolean $is_show_stats whether stats is show or not * @param boolean $ignored ignored * @param boolean $do do * @param intger $colspan_for_structure colspan for structure * * @return string $html_output */ function PMA_getHtmlForStructureTableRow($curr, $odd_row, $table_is_view, $current_table, $checked, $browse_table_label, $tracking_icon,$server_slave_status, $browse_table, $tbl_url_query, $search_table, $db_is_information_schema,$titles, $empty_table, $drop_query, $drop_message, $collation, $formatted_size, $unit, $overhead, $create_time, $update_time, $check_time,$is_show_stats, $ignored, $do, $colspan_for_structure ) { $common_functions = PMA_CommonFunctions::getInstance(); $html_output = ''; $html_output .= '' . ''; $html_output .= '' . $browse_table_label . (! empty($tracking_icon) ? $tracking_icon : '') . ''; if ($server_slave_status) { $html_output .= '' . ($ignored ? $common_functions->getImage('s_cancel.png', 'NOT REPLICATED') : '') . ($do ? $common_functions->getImage('s_success.png', 'REPLICATED') : '') . ''; } $html_output .= '' . $browse_table . ''; $html_output .= '' . '' . $titles['Structure'] . ''; $html_output .= '' . $search_table . ''; if (! $db_is_information_schema) { $html_output .= PMA_getHtmlForInsertEmptyDropActionLinks( $tbl_url_query, $table_is_view, $titles, $empty_table, $current_table, $drop_query, $drop_message ); } // end if (! $db_is_information_schema) // there is a null value in the ENGINE // - when the table needs to be repaired, or // - when it's a view // so ensure that we'll display "in use" below for a table // that needs to be repaired if (isset($current_table['TABLE_ROWS']) && ($current_table['ENGINE'] != null || $table_is_view) ) { $html_output .= PMA_getHtmlForNotNullEngineViewTable( $table_is_view, $current_table, $collation, $is_show_stats, $tbl_url_query, $formatted_size, $unit, $overhead, $create_time, $update_time, $check_time ); } elseif ($table_is_view) { $html_output .= PMA_getHtmlForViewTable($is_show_stats); } else { $html_output .= PMA_getHtmlForRepairtable($colspan_for_structure, $db_is_information_schema ); } // end if (isset($current_table['TABLE_ROWS'])) else $html_output .= ''; return $html_output; } /** * Get HTML for Insert/Empty/Drop action links * * @param string $tbl_url_query table url query * @param boolean $table_is_view whether table is view or not * @param array $titles titles array * @param string $empty_table HTML link for empty table * @param array $current_table current table * @param string $drop_query query for drop table * @param string $drop_message table drop message * * @return string $html_output */ function PMA_getHtmlForInsertEmptyDropActionLinks($tbl_url_query, $table_is_view, $titles, $empty_table, $current_table, $drop_query, $drop_message ) { $html_output = '' . '' . $titles['Insert'] . ''; $html_output .= '' . $empty_table . ''; $html_output .= ''; $html_output .= '' . $titles['Drop'] . ''; return $html_output; } /** * Get HTML for show stats * * @param string $tbl_url_query tabel url query * @param string $formatted_size formatted size * @param string $unit unit * @param string $overhead overhead * * @return string $html_output */ function PMA_getHtmlForShowStats($tbl_url_query, $formatted_size, $unit, $overhead ) { $html_output = '' . '' . $formatted_size . ' ' . '' . $unit . '' . ''; $html_output .= '' . $overhead . ''; return $html_output; } /** * Get HTML to show database structure creation, last update and last checkx time * * @param string $create_time create time * @param string $update_time last update time * @param string $check_time last check time * * @return string $html_output */ function PMA_getHtmlForStructureTimes($create_time, $update_time, $check_time) { $common_functions = PMA_CommonFunctions::getInstance(); $html_output = ''; if ($GLOBALS['cfg']['ShowDbStructureCreation']) { $html_output .= '' . ($create_time ? $common_functions->localisedDate(strtotime($create_time)) : '-' ) . ''; } // end if if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { $html_output .= '' . ($update_time ? $common_functions->localisedDate(strtotime($update_time)) : '-' ) . ''; } // end if if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { $html_output .= '' . ($check_time ? $common_functions->localisedDate(strtotime($check_time)) : '-' ) . ''; } return $html_output; } /** * 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 ) { $common_functions = PMA_CommonFunctions::getInstance(); $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 = $common_functions->showHint( PMA_sanitize( sprintf( __('This view has at least this number of rows. Please refer to %sdocumentation%s.'), '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]' ) ) ); } } 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 .= '' . $row_count_pre . $common_functions->formatNumber( $current_table['TABLE_ROWS'], 0 ) . $show_superscript . ''; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { $html_output .= '' . ($table_is_view ? __('View') : $current_table['ENGINE']) . ''; if (strlen($collation)) { $html_output .= '' . $collation . ''; } } 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; } /** * Get HTML snippet view table * * @param type $is_show_stats whether stats show or not * * @return string $html_output */ function PMA_getHtmlForViewTable($is_show_stats) { $html_output = '-' . '' . __('View') . '' . '---'; if ($is_show_stats) { $html_output .= '-' . '-'; } return $html_output; } /** * display "in use" below for a table that needs to be repaired * * @param integer $colspan_for_structure colspan for structure * @param boolean $db_is_information_schema whether db is information schema or not * * @return string HTML snippet */ function PMA_getHtmlForRepairtable( $colspan_for_structure, $db_is_information_schema ) { return '' . __('in use') . ''; } /** * void PMA_TableHeader([bool $db_is_information_schema = false]) * display table header (...) * * @param boolean $db_is_information_schema * @param boolean $replication */ function PMA_TableHeader($db_is_information_schema = false, $replication = false) { $cnt = 0; // Let's count the columns... if ($db_is_information_schema) { $action_colspan = 3; } else { $action_colspan = 6; } $html_output = '
' . "\n" .'' . "\n" .'' . "\n" .'' . "\n"; if ($replication) { $html_output .= ''; } $html_output .= '' // larger values are more interesting so default sort order is DESC .'' . "\n"; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { $html_output .= '' . "\n"; $cnt++; $html_output .= '' . "\n"; $cnt++; } if ($GLOBALS['is_show_stats']) { // larger values are more interesting so default sort order is DESC $html_output .= '' . "\n" // larger values are more interesting so default sort order is DESC . '' . "\n"; $cnt += 2; } if ($GLOBALS['cfg']['ShowDbStructureCreation']) { // larger values are more interesting so default sort order is DESC $html_output .= '' . "\n"; $cnt += 2; } if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { // larger values are more interesting so default sort order is DESC $html_output .= '' . "\n"; $cnt += 2; } if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { // larger values are more interesting so default sort order is DESC $html_output .= '' . "\n"; $cnt += 2; } $html_output .= '' . "\n"; $html_output .= '' . "\n"; $html_output .= '' . "\n"; $GLOBALS['colspan_for_structure'] = $cnt + $action_colspan + 3; return $html_output; } /** * Creates a clickable column header for table information * * @param string $title title to use for the link * @param string $sort corresponds to sortable data name mapped in * libraries/db_info.inc.php * @param string $initial_sort_order initial sort order * * @return string link to be displayed in the table header */ function PMA_SortableTableHeader($title, $sort, $initial_sort_order = 'ASC') { $common_functions = PMA_CommonFunctions::getInstance(); // Set some defaults $requested_sort = 'table'; $requested_sort_order = $future_sort_order = $initial_sort_order; // If the user requested a sort if (isset($_REQUEST['sort'])) { $requested_sort = $_REQUEST['sort']; if (isset($_REQUEST['sort_order'])) { $requested_sort_order = $_REQUEST['sort_order']; } } $order_img = ''; $order_link_params = array(); $order_link_params['title'] = __('Sort'); // If this column was requested to be sorted. if ($requested_sort == $sort) { if ($requested_sort_order == 'ASC') { $future_sort_order = 'DESC'; // current sort order is ASC $order_img = ' ' . $common_functions->getImage( 's_asc.png', __('Ascending'), array('class' => 'sort_arrow', 'title' => '') ); $order_img .= ' ' . $common_functions->getImage( 's_desc.png', __('Descending'), array('class' => 'sort_arrow hide', 'title' => '') ); // but on mouse over, show the reverse order (DESC) $order_link_params['onmouseover'] = "$('.sort_arrow').toggle();"; // on mouse out, show current sort order (ASC) $order_link_params['onmouseout'] = "$('.sort_arrow').toggle();"; } else { $future_sort_order = 'ASC'; // current sort order is DESC $order_img = ' ' . $common_functions->getImage( 's_asc.png', __('Ascending'), array('class' => 'sort_arrow hide', 'title' => '') ); $order_img .= ' ' . $common_functions->getImage( 's_desc.png', __('Descending'), array('class' => 'sort_arrow', 'title' => '') ); // but on mouse over, show the reverse order (ASC) $order_link_params['onmouseover'] = "$('.sort_arrow').toggle();"; // on mouse out, show current sort order (DESC) $order_link_params['onmouseout'] = "$('.sort_arrow').toggle();"; } } $_url_params = array( 'db' => $_REQUEST['db'], ); $url = 'db_structure.php'.PMA_generate_common_url($_url_params); // We set the position back to 0 every time they sort. $url .= "&pos=0&sort=$sort&sort_order=$future_sort_order"; return PMA_CommonFunctions::getInstance()->linkOrButton( $url, $title . $order_img, $order_link_params ); } /** * Get the alias ant truname * * @param string $tooltip_aliasname tooltip alias name * @param array $current_table current table * @param string $tooltip_truename tooltip true name * * @return array ($alias, $truename) */ function PMA_getAliasAndTruename($tooltip_aliasname, $current_table, $tooltip_truename ) { $alias = (! empty($tooltip_aliasname) && isset($tooltip_aliasname[$current_table['TABLE_NAME']]) ) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$current_table['TABLE_NAME']]) ) : str_replace(' ', ' ', htmlspecialchars($current_table['TABLE_NAME']) ); $truename = (! empty($tooltip_truename) && isset($tooltip_truename[$current_table['TABLE_NAME']]) ) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$current_table['TABLE_NAME']]) ) : str_replace(' ', ' ', htmlspecialchars($current_table['TABLE_NAME']) ); return array($alias, $truename); } /** * Get the server slave state * * @param boolean $server_slave_status server slave state * @param string $truename true name * * @return array ($do, $ignored) */ function PMA_getServerSlaveStatus($server_slave_status, $truename) { $ignored = false; $do = false; include_once 'libraries/replication.inc.php'; if ($server_slave_status) { if ((strlen(array_search($truename, $server_slave_Do_Table)) > 0) || (strlen(array_search($GLOBALS['db'], $server_slave_Do_DB)) > 0) || (count($server_slave_Do_DB) == 1 && count($server_slave_Ignore_DB) == 1) ) { $do = true; } foreach ($server_slave_Wild_Do_Table as $db_table) { $table_part = PMA_extract_db_or_table($db_table, 'table'); if (($GLOBALS['db'] == PMA_extract_db_or_table($db_table, 'db')) && (preg_match( "@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename) ) ) { $do = true; } } if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($GLOBALS['db'], $server_slave_Ignore_DB)) > 0) ) { $ignored = true; } foreach ($server_slave_Wild_Ignore_Table as $db_table) { $table_part = PMA_extract_db_or_table($db_table, 'table'); if (($db == PMA_extract_db_or_table($db_table)) && (preg_match( "@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename) ) ) { $ignored = true; } } } return array($do, $ignored); } /** * Get the value set for ENGINE table, * $current_table, $formatted_size, $unit, $formatted_overhead, * $overhead_unit, $overhead_size, $table_is_view * * @param array $current_table current table * @param boolean $db_is_information_schema whether db is information schema or not * @param boolean $is_show_stats whether stats show or not * * @return array */ function PMA_getStuffForEnginetable($current_table, $db_is_information_schema, $is_show_stats ) { $common_functions = PMA_CommonFunctions::getInstance(); $sum_size = (double) 0; $overhead_size = (double) 0; $formatted_size = '-'; $unit = ''; $formatted_overhead = ''; $overhead_unit = ''; switch ( $current_table['ENGINE']) { // MyISAM, ISAM or Heap table: Row count, data size and index size // are accurate; data size is accurate for ARCHIVE case 'MyISAM' : case 'ISAM' : case 'HEAP' : case 'MEMORY' : case 'ARCHIVE' : case 'Aria' : case 'Maria' : list($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size) = PMA_getValuesForMariaTable( $db_is_information_schema, $current_table, $is_show_stats, $sum_size, $overhead_size ); break; case 'InnoDB' : case 'PBMS' : // InnoDB table: Row count is not accurate but data and index sizes are. // PBMS table in Drizzle: TABLE_ROWS is taken from table cache, // so it may be unavailable list($current_table, $formatted_size, $unit, $sum_size) = PMA_getValuesForPbmsTable($current_table, $is_show_stats, $sum_size); //$display_rows = ' - '; break; // Mysql 5.0.x (and lower) uses MRG_MyISAM // and MySQL 5.1.x (and higher) uses MRG_MYISAM // Both are aliases for MERGE case 'MRG_MyISAM' : case 'MRG_MYISAM' : case 'MERGE' : case 'BerkeleyDB' : // Merge or BerkleyDB table: Only row count is accurate. if ($is_show_stats) { $formatted_size = ' - '; $unit = ''; } break; // for a view, the ENGINE is sometimes reported as null, // or on some servers it's reported as "SYSTEM VIEW" case null : case 'SYSTEM VIEW' : case 'FunctionEngine' : // if table is broken, Engine is reported as null, so one more test if ($current_table['TABLE_TYPE'] == 'VIEW') { // countRecords() takes care of $cfg['MaxExactCountViews'] $current_table['TABLE_ROWS'] = PMA_Table::countRecords( $GLOBALS['db'], $current_table['TABLE_NAME'], $force_exact = true, $is_view = true ); $table_is_view = true; } break; default : // Unknown table type. if ($is_show_stats) { $formatted_size = __('unknown'); $unit = ''; } } // end switch return array($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size, $table_is_view ); } /** * Get values for MARIA tables * $current_table, $formatted_size, $unit, $formatted_overhead, * $overhead_unit, $overhead_size * * @param boolean $db_is_information_schema whether db is information schema or not * @param array $current_table current table * @param boolean $is_show_stats whether stats show or not * @param double $sum_size sum size * @param double $overhead_size overhead size * * @return array */ function PMA_getValuesForMariaTable($db_is_information_schema, $current_table, $is_show_stats, $sum_size, $overhead_size ) { $common_functions = PMA_CommonFunctions::getInstance(); if ($db_is_information_schema) { $current_table['Rows'] = PMA_Table::countRecords( $GLOBALS['db'], $current_table['Name'] ); } if ($is_show_stats) { $tblsize = doubleval($current_table['Data_length']) + doubleval($current_table['Index_length']); $sum_size += $tblsize; list($formatted_size, $unit) = $common_functions->formatByteDown( $tblsize, 3, ($tblsize > 0) ? 1 : 0 ); if (isset($current_table['Data_free']) && $current_table['Data_free'] > 0) { list($formatted_overhead, $overhead_unit) = $common_functions->formatByteDown( $current_table['Data_free'], 3, ($current_table['Data_free'] > 0) ? 1 : 0 ); $overhead_size += $current_table['Data_free']; } } return array($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size ); } /** * Get valuse for PBMS table * $current_table, $formatted_size, $unit, $sum_size * * @param array $current_table current table * @param boolean $is_show_stats whether stats show or not * @param double $sum_size sum size * * @return array */ function PMA_getValuesForPbmsTable($current_table, $is_show_stats, $sum_size) { $common_functions = PMA_CommonFunctions::getInstance(); if (($current_table['ENGINE'] == 'InnoDB' && $current_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) || !isset($current_table['TABLE_ROWS']) ) { $current_table['COUNTED'] = true; $current_table['TABLE_ROWS'] = PMA_Table::countRecords( $GLOBALS['db'], $current_table['TABLE_NAME'], $force_exact = true, $is_view = false ); } else { $current_table['COUNTED'] = false; } // Drizzle doesn't provide data and index length, check for null if ($is_show_stats && $current_table['Data_length'] !== null) { $tblsize = $current_table['Data_length'] + $current_table['Index_length']; $sum_size += $tblsize; list($formatted_size, $unit) = $common_functions->formatByteDown( $tblsize, 3, ($tblsize > 0) ? 1 : 0 ); } return array($current_table, $formatted_size, $unit, $sum_size); } /** * table structure */ /** * Get the HTML snippet for structure table table header * * @param type $db_is_information_schema whether db is information schema or not * @param type $tbl_is_view whether table is view or nt * * @return string $html_output */ function PMA_getHtmlForTableStructureHeader( $db_is_information_schema, $tbl_is_view ) { $html_output = ''; $html_output .= ''; $html_output .= '' . '' . '' . '' . '' . '' . '' . '' . ''; if ($db_is_information_schema || $tbl_is_view) { $html_output .= ''; } else { /* see tbl_structure.js, function moreOptsMenuResize() */ $colspan = 9; if (PMA_DRIZZLE) { $colspan -= 2; } if ($GLOBALS['cfg']['PropertiesIconic']) { $colspan--; } $html_output .= ''; } $html_output .= '' . ''; return $html_output; } ?>
' . PMA_SortableTableHeader(__('Table'), 'table') . '' . "\n" .' ' . __('Replication') . "\n" .'' . "\n" .' ' . __('Action') . "\n" .'' . PMA_SortableTableHeader(__('Rows'), 'records', 'DESC') . PMA_CommonFunctions::getInstance()->showHint( PMA_sanitize( __('May be approximate. See [a@./Documentation.html#faq3_11@Documentation]FAQ 3.11[/a]') ) ) . "\n" .'' . PMA_SortableTableHeader(__('Type'), 'type') . '' . PMA_SortableTableHeader(__('Collation'), 'collation') . '' . PMA_SortableTableHeader(__('Size'), 'size', 'DESC') . '' . PMA_SortableTableHeader(__('Overhead'), 'overhead', 'DESC') . '' . PMA_SortableTableHeader(__('Creation'), 'creation', 'DESC') . '' . PMA_SortableTableHeader(__('Last update'), 'last_update', 'DESC') . '' . PMA_SortableTableHeader(__('Last check'), 'last_check', 'DESC') . '
#' . __('Name') . '' . __('Type'). '' . __('Collation') . '' . __('Attributes') . '' . __('Null') . '' . __('Default') . '' . __('Extra') . '' . __('View') . '' . __('Action') . '