Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: tbl_properties_table_info.php,v 2.15 2005/08/11 13:56:32 lem9 Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00005 // this should be recoded as functions, to avoid messing with global 00006 // variables 00007 00008 require_once('./libraries/common.lib.php'); 00009 00010 // Check parameters 00011 PMA_checkParameters(array('db', 'table')); 00012 00017 global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation, 00018 $table_info_num_rows, $auto_increment; 00019 00024 // Seems we need to do this in MySQL 5.0.2, 00025 // otherwise error #1046, no database selected 00026 PMA_DBI_select_db($db); 00027 00028 // The 'show table' statement works correct since 3.23.03 00029 $table_info_result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE); 00030 00031 // need this test because when we are creating a table, we get 0 rows 00032 // from the SHOW TABLE query 00033 // and we don't want to mess up the $tbl_type coming from the form 00034 00035 if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) { 00036 $showtable = PMA_DBI_fetch_assoc($table_info_result); 00037 if (!isset($showtable['Type']) && isset($showtable['Engine'])) { 00038 $showtable['Type'] =& $showtable['Engine']; 00039 } 00040 if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) && isset($showtable['Comment']) && $showtable['Comment'] == 'view') { 00041 $tbl_is_view = TRUE; 00042 $tbl_type = $strView; 00043 $show_comment = NULL; 00044 } else { 00045 $tbl_is_view = FALSE; 00046 $tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : ''; 00047 // a new comment could be coming from tbl_properties_operations.php 00048 // and we want to show it in the header 00049 if (isset($submitcomment) && isset($comment)) { 00050 $show_comment = $comment; 00051 } else { 00052 $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); 00053 } 00054 } 00055 $tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation']; 00056 $table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); 00057 $auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : ''); 00058 00059 $tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array(); 00060 $tmp_cnt = count($tmp); 00061 for ($i = 0; $i < $tmp_cnt; $i++) { 00062 $tmp1 = explode('=', $tmp[$i]); 00063 if (isset($tmp1[1])) { 00064 $$tmp1[0] = $tmp1[1]; 00065 } 00066 } // end for 00067 PMA_DBI_free_result($table_info_result); 00068 unset($tmp1, $tmp, $table_info_result); 00069 } // end if 00070 ?>