2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Ensure the database and the table exist (else move to the "parent" script)
10 if (! defined('PHPMYADMIN')) {
17 require_once './libraries/Table.class.php';
21 $is_db = @PMA_DBI_select_db
($db);
27 // not a valid db name -> back to the welcome page
28 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
29 $url_params = array('reload' => 1);
30 if (isset($message)) {
31 $url_params['message'] = $message;
33 if (! empty($sql_query)) {
34 $url_params['sql_query'] = $sql_query;
36 if (isset($show_as_php)) {
37 $url_params['show_as_php'] = $show_as_php;
39 PMA_sendHeaderLocation(
40 $cfg['PmaAbsoluteUri'] . 'main.php'
41 . PMA_generate_common_url($url_params, '&'));
45 } // end if (ensures db exists)
47 if (empty($is_table) && !defined('PMA_SUBMIT_MULT') && ! defined('TABLE_MAY_BE_ABSENT')) {
48 // Not a valid table name -> back to the db_sql.php
51 $is_table = isset(PMA_Table
::$cache[$db][$table]);
54 $_result = PMA_DBI_try_query(
55 'SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, true) . '\';',
56 null, PMA_DBI_QUERY_STORE
);
57 $is_table = @PMA_DBI_num_rows
($_result);
58 PMA_DBI_free_result($_result);
65 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
67 // SHOW TABLES doesn't show temporary tables, so try select
68 // (as it can happen just in case temporary table, it should be
72 * @todo should this check really only happen if IS_TRANSFORMATION_WRAPPER?
74 $_result = PMA_DBI_try_query(
75 'SELECT COUNT(*) FROM ' . PMA_backquote($table) . ';',
76 null, PMA_DBI_QUERY_STORE
);
77 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
78 PMA_DBI_free_result($_result);
82 require './db_sql.php';
91 } // end if (ensures table exists)