$sval) {
if ($sql_query == '') {
$sql_query .= 'SELECT ' . PMA_backquote($sval);
} else {
$sql_query .= ', ' . PMA_backquote($sval);
}
}
// what is this htmlspecialchars() for??
//$sql_query .= ' FROM ' . PMA_backquote(htmlspecialchars($table));
$sql_query .= ' FROM ' . PMA_backquote($table);
require './sql.php';
} else {
$action = 'tbl_structure.php';
require_once './libraries/header.inc.php';
require_once './libraries/tbl_links.inc.php';
require './libraries/mult_submits.inc.php';
}
exit;
}
/**
* Runs common work
*/
require_once './libraries/tbl_common.php';
$url_query .= '&goto=tbl_structure.php&back=tbl_structure.php';
/**
* Prepares the table structure display
*/
/**
* Gets tables informations
*/
require_once './libraries/tbl_info.inc.php';
/**
* Show result of multi submit operation
*/
if ((!empty($submit_mult) && isset($selected_fld))
|| isset($mult_btn)) {
$message = $strSuccess;
}
/**
* Displays top menu links
*/
require_once './libraries/tbl_links.inc.php';
// 2. Gets table keys and retains them
$result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table) . ';');
$primary = '';
$ret_keys = array();
$pk_array = array(); // will be use to emphasis prim. keys in the table view
while ($row = PMA_DBI_fetch_assoc($result)) {
$ret_keys[] = $row;
// Backups the list of primary keys
if ($row['Key_name'] == 'PRIMARY') {
$primary .= $row['Column_name'] . ', ';
$pk_array[$row['Column_name']] = 1;
}
} // end while
PMA_DBI_free_result($result);
// 3. Get fields
$fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
$fields_cnt = PMA_DBI_num_rows($fields_rs);
// Get more complete field information
// For now, this is done just for MySQL 4.1.2+ new TIMESTAMP options
// but later, if the analyser returns more information, it
// could be executed for any MySQL version and replace
// the info given by SHOW FULL FIELDS FROM.
//
// We also need this to correctly learn if a TIMESTAMP is NOT NULL, since
// SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL
// and SHOW CREATE TABLE says NOT NULL (tested
// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
$show_create_table = PMA_DBI_fetch_value(
'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
0, 1);
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
/**
* prepare table infos
*/
// action titles (image or string)
$titles = array();
if ($cfg['PropertiesIconic'] == true) {
if ($cfg['PropertiesIconic'] === 'both') {
$iconic_spacer = '
';
} else {
$iconic_spacer = '';
}
// images replaced 2004-05-08 by mkkeck
$titles['Change'] = $iconic_spacer
. '

';
$titles['Drop'] = $iconic_spacer
. '

';
$titles['NoDrop'] = $iconic_spacer
. '

';
$titles['Primary'] = $iconic_spacer
. '

';
$titles['Index'] = $iconic_spacer
. '

';
$titles['Unique'] = $iconic_spacer
. '

';
$titles['IdxFulltext'] = $iconic_spacer
. '

';
$titles['NoPrimary'] = $iconic_spacer
. '

';
$titles['NoIndex'] = $iconic_spacer
. '

';
$titles['NoUnique'] = $iconic_spacer
. '

';
$titles['NoIdxFulltext'] = $iconic_spacer
. '

';
$titles['BrowseDistinctValues'] = $iconic_spacer
. '

';
if ($cfg['PropertiesIconic'] === 'both') {
$titles['Change'] .= $strChange . '
';
$titles['Drop'] .= $strDrop . '';
$titles['NoDrop'] .= $strDrop . '';
$titles['Primary'] .= $strPrimary . '';
$titles['Index'] .= $strIndex . '';
$titles['Unique'] .= $strUnique . '';
$titles['IdxFulltext' ] .= $strIdxFulltext . '';
$titles['NoPrimary'] .= $strPrimary . '';
$titles['NoIndex'] .= $strIndex . '';
$titles['NoUnique'] .= $strUnique . '';
$titles['NoIdxFulltext'] .= $strIdxFulltext . '';
$titles['BrowseDistinctValues'] .= $strBrowseDistinctValues . '';
}
} else {
$titles['Change'] = $strChange;
$titles['Drop'] = $strDrop;
$titles['NoDrop'] = $strDrop;
$titles['Primary'] = $strPrimary;
$titles['Index'] = $strIndex;
$titles['Unique'] = $strUnique;
$titles['IdxFulltext'] = $strIdxFulltext;
$titles['NoPrimary'] = $strPrimary;
$titles['NoIndex'] = $strIndex;
$titles['NoUnique'] = $strUnique;
$titles['NoIdxFulltext'] = $strIdxFulltext;
$titles['BrowseDistinctValues'] = $strBrowseDistinctValues;
}
/**
* Displays the table structure ('show table' works correct since 3.23.03)
*/
/* TABLE INFORMATION */
// table header
$i = 0;
?>
';
}
echo $strPrintView;
?>
';
}
echo $strRelationView;
?>
';
}
echo $strStructPropose;
?>
20) {
require './libraries/tbl_links.inc.php';
} // end if ($fields_cnt > 20)
echo "\n\n";
/**
* Displays indexes
*/
echo '' . "\n";
if (! $tbl_is_view && ! $db_is_information_schema) {
define('PMA_IDX_INCLUDED', 1);
require './tbl_indexes.php';
}
/**
* Displays Space usage and row statistics
*/
// BEGIN - Calc Table Space - staybyte - 9 June 2001
// loic1, 22 feb. 2002: updated with patch from
// Joshua Nye
to get valid
// statistics whatever is the table type
if ($cfg['ShowStats']) {
$nonisam = false;
$is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
$nonisam = true;
}
// Gets some sizes
$mergetable = false;
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
$mergetable = true;
}
list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
if ($mergetable == false) {
list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
}
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free']);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
} else {
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
}
list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
if ($table_info_num_rows > 0) {
list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
}
// Displays them
$odd_row = false;
?>
|
|
|
|
= 40100 && !empty($tbl_collation)) {
?>
|
' . $tbl_collation . '';
?> |
|
|
0) {
?>
ø |
|
0 && $mergetable == false) {
?>
ø |
|
Autoindex |
|
|
|
|
|
|
|
' . "\n";
echo '' . "\n";
/**
* Displays the footer
*/
require_once './libraries/footer.inc.php';
?>