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')) {
16 require_once './libraries/Table.class.php';
20 $is_db = @PMA_DBI_select_db
($db);
26 // not a valid db name -> back to the welcome page
27 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
28 $url_params = array('reload' => 1);
29 if (isset($message)) {
30 $url_params['message'] = $message;
32 if (! empty($sql_query)) {
33 $url_params['sql_query'] = $sql_query;
35 if (isset($show_as_php)) {
36 $url_params['show_as_php'] = $show_as_php;
38 PMA_sendHeaderLocation(
39 $cfg['PmaAbsoluteUri'] . 'main.php'
40 . PMA_generate_common_url($url_params, '&'));
44 } // end if (ensures db exists)
46 if (empty($is_table) && !defined('PMA_SUBMIT_MULT')) {
47 // Not a valid table name -> back to the db_sql.php
50 $is_table = isset(PMA_Table
::$cache[$db][$table]);
53 $_result = PMA_DBI_try_query(
54 'SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, true) . '\';',
55 null, PMA_DBI_QUERY_STORE
);
56 $is_table = @PMA_DBI_num_rows
($_result);
57 PMA_DBI_free_result($_result);
64 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
66 // SHOW TABLES doesn't show temporary tables, so try select
67 // (as it can happen just in case temporary table, it should be
71 * @todo should this check really only happen if IS_TRANSFORMATION_WRAPPER?
73 $_result = PMA_DBI_try_query(
74 'SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, true) . '`;',
75 null, PMA_DBI_QUERY_STORE
);
76 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
77 PMA_DBI_free_result($_result);
81 $url_params = array('reload' => 1, 'db' => $db);
82 if (isset($message)) {
83 $url_params['message'] = $message;
85 if (! empty($sql_query)) {
86 $url_params['sql_query'] = $sql_query;
88 if (isset($display_query)) {
89 $url_params['display_query'] = $display_query;
91 PMA_sendHeaderLocation(
92 $cfg['PmaAbsoluteUri'] . 'db_sql.php'
93 . PMA_generate_common_url($url_params, '&'));
101 } // end if (ensures table exists)