2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Ensure the database and the table exist (else move to the "parent" script)
9 if (! defined('PHPMYADMIN')) {
15 $is_db = @PMA_DBI_select_db
($db);
21 // not a valid db name -> back to the welcome page
22 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
23 $url_params = array('reload' => 1);
24 if (isset($message)) {
25 $url_params['message'] = $message;
27 if (! empty($sql_query)) {
28 $url_params['sql_query'] = $sql_query;
30 if (isset($show_as_php)) {
31 $url_params['show_as_php'] = $show_as_php;
33 PMA_sendHeaderLocation(
34 $cfg['PmaAbsoluteUri'] . 'main.php'
35 . PMA_generate_common_url($url_params, '&'));
39 } // end if (ensures db exists)
41 if (empty($is_table) && !defined('PMA_SUBMIT_MULT') && ! defined('TABLE_MAY_BE_ABSENT')) {
42 // Not a valid table name -> back to the db_sql.php
45 $is_table = isset(PMA_Table
::$cache[$db][$table]);
48 $_result = PMA_DBI_try_query(
49 'SHOW TABLES LIKE \'' . PMA_sqlAddSlashes($table, true) . '\';',
50 null, PMA_DBI_QUERY_STORE
);
51 $is_table = @PMA_DBI_num_rows
($_result);
52 PMA_DBI_free_result($_result);
59 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
61 // SHOW TABLES doesn't show temporary tables, so try select
62 // (as it can happen just in case temporary table, it should be
66 * @todo should this check really only happen if IS_TRANSFORMATION_WRAPPER?
68 $_result = PMA_DBI_try_query(
69 'SELECT COUNT(*) FROM ' . PMA_backquote($table) . ';',
70 null, PMA_DBI_QUERY_STORE
);
71 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
72 PMA_DBI_free_result($_result);
76 include './db_sql.php';
85 } // end if (ensures table exists)