diff --git a/htdocs/sql/libraries/tbl_info.inc.php b/htdocs/sql/libraries/tbl_info.inc.php new file mode 100755 --- /dev/null +++ b/htdocs/sql/libraries/tbl_info.inc.php @@ -0,0 +1,111 @@ + 0) { + $showtable = PMA_DBI_fetch_assoc($table_info_result); + PMA_DBI_free_result($table_info_result); + unset($table_info_result); + + if (!isset($showtable['Type']) && isset($showtable['Engine'])) { + $showtable['Type'] =& $showtable['Engine']; + } + if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) { + $tbl_is_view = true; + $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_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_Table::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' + unset($pack_keys); + 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]; + } + } + // we need explicit DEFAULT value here (different from '0') + $pack_keys = (!isset($pack_keys) || strlen($pack_keys) == 0) ? 'DEFAULT' : $pack_keys; + unset($create_options, $each_create_option); +} // end if +?>