2
/* $Id: tbl_properties_table_info.php,v 2.17 2005/10/11 14:00:41 cybot_tm Exp $ */
3
// vim: expandtab sw=4 ts=4 sts=4:
5
// this should be recoded as functions, to avoid messing with global
8
require_once('./libraries/common.lib.php');
11
PMA_checkParameters(array('db', 'table'));
14
* Defining global variables, in case this script is included by a function.
15
* This is necessary because this script can be included by header.inc.php.
17
global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation,
18
$table_info_num_rows, $auto_increment;
21
* Gets table informations
24
// Seems we need to do this in MySQL 5.0.2,
25
// otherwise error #1046, no database selected
26
PMA_DBI_select_db($db);
28
// The 'show table' statement works correct since 3.23.03
29
$table_info_result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
31
// need this test because when we are creating a table, we get 0 rows
32
// from the SHOW TABLE query
33
// and we don't want to mess up the $tbl_type coming from the form
35
if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
36
$showtable = PMA_DBI_fetch_assoc($table_info_result);
37
if (!isset($showtable['Type']) && isset($showtable['Engine'])) {
38
$showtable['Type'] =& $showtable['Engine'];
40
// MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW"
41
if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) && isset($showtable['Comment']) && strtoupper($showtable['Comment']) == 'VIEW') {
47
$tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
48
// a new comment could be coming from tbl_properties_operations.php
49
// and we want to show it in the header
50
if (isset($submitcomment) && isset($comment)) {
51
$show_comment = $comment;
53
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
56
$tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation'];
58
if ( NULL === $showtable['Rows'] ) {
59
$showtable['Rows'] = PMA_countRecords( $GLOBALS['db'],
60
$showtable['Name'], $return = true, $force_exact = true );
62
$table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
63
$auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
65
$tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
66
$tmp_cnt = count($tmp);
67
for ($i = 0; $i < $tmp_cnt; $i++) {
68
$tmp1 = explode('=', $tmp[$i]);
69
if (isset($tmp1[1])) {
73
PMA_DBI_free_result($table_info_result);
74
unset($tmp1, $tmp, $table_info_result);