3 // vim: expandtab sw=4 ts=4 sts=4:
6 * Ensure the database and the table exist (else move to the "parent" script)
10 if (isset($db) && strlen($db)) {
11 $is_db = @PMA_DBI_select_db
($db);
17 // not a valid db name -> back to the welcome page
18 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
19 $url_params = array('reload' => 1);
20 if (isset($message)) {
21 $url_params['message'] = $message;
23 PMA_sendHeaderLocation(
24 $cfg['PmaAbsoluteUri'] . 'main.php'
25 . PMA_generate_common_url($url_params, '&'));
29 } // end if (ensures db exists)
31 if (empty($is_table) && !defined('PMA_SUBMIT_MULT')) {
32 // Not a valid table name -> back to the db_details.php
33 if (isset($table) && strlen($table)) {
34 $_result = PMA_DBI_try_query(
35 'SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, true) . '\';',
36 null, PMA_DBI_QUERY_STORE
);
37 $is_table = @PMA_DBI_num_rows
($_result);
38 PMA_DBI_free_result($_result);
44 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
45 if (isset($table) && strlen($table)) {
46 // SHOW TABLES doesn't show temporary tables, so try select
47 // (as it can happen just in case temporary table, it should be
51 * @todo should this check really only happen if IS_TRANSFORMATION_WRAPPER?
53 $_result = PMA_DBI_try_query(
54 'SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, true) . '`;',
55 null, PMA_DBI_QUERY_STORE
);
56 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
57 PMA_DBI_free_result($_result);
61 $url_params = array('reload' => 1, 'db' => $db);
62 if (isset($message)) {
63 $url_params['message'] = $message;
65 if (isset($sql_query)) {
66 $url_params['sql_query'] = $sql_query;
68 if (isset($display_query)) {
69 $url_params['display_query'] = $display_query;
71 PMA_sendHeaderLocation(
72 $cfg['PmaAbsoluteUri'] . 'db_details.php'
73 . PMA_generate_common_url($url_params, '&'));
81 } // end if (ensures table exists)