no table creation in information_schema
[phpmyadmin/crack.git] / tbl_properties_table_info.php
blobbd6e3fc5142cfa7230a929c582401894d3aa0862
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 // this should be recoded as functions, to avoid messing with global
6 // variables
8 // Check parameters
10 require_once('./libraries/common.lib.php');
12 PMA_checkParameters(array('db', 'table'));
14 /**
15 * Defining global variables, in case this script is included by a function.
16 * This is necessary because this script can be included by header.inc.php.
18 global $showtable, $tbl_is_view, $tbl_type, $show_comment, $tbl_collation,
19 $table_info_num_rows, $auto_increment;
21 /**
22 * Gets table informations
25 // Seems we need to do this in MySQL 5.0.2,
26 // otherwise error #1046, no database selected
27 PMA_DBI_select_db($db);
29 // The 'show table' statement works correct since 3.23.03
30 $table_info_result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE);
32 // need this test because when we are creating a table, we get 0 rows
33 // from the SHOW TABLE query
34 // and we don't want to mess up the $tbl_type coming from the form
36 if ($table_info_result && PMA_DBI_num_rows($table_info_result) > 0) {
37 $showtable = PMA_DBI_fetch_assoc($table_info_result);
38 if (!isset($showtable['Type']) && isset($showtable['Engine'])) {
39 $showtable['Type'] =& $showtable['Engine'];
41 if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) && isset($showtable['Comment']) && $showtable['Comment'] == 'view') {
42 $tbl_is_view = TRUE;
43 $tbl_type = $strView;
44 $show_comment = NULL;
45 } else {
46 $tbl_is_view = FALSE;
47 $tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
48 $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
50 $tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation'];
51 $table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
52 $auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
54 $tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
55 $tmp_cnt = count($tmp);
56 for ($i = 0; $i < $tmp_cnt; $i++) {
57 $tmp1 = explode('=', $tmp[$i]);
58 if (isset($tmp1[1])) {
59 $$tmp1[0] = $tmp1[1];
61 } // end for
62 PMA_DBI_free_result($table_info_result);
63 unset($tmp1, $tmp, $table_info_result);
64 } // end if