2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Ensure the database and the table exist (else move to the "parent" script)
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')) {
42 // Not a valid table name -> back to the db_sql.php
44 $_result = PMA_DBI_try_query(
45 'SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, true) . '\';',
46 null, PMA_DBI_QUERY_STORE
);
47 $is_table = @PMA_DBI_num_rows
($_result);
48 PMA_DBI_free_result($_result);
54 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
56 // SHOW TABLES doesn't show temporary tables, so try select
57 // (as it can happen just in case temporary table, it should be
61 * @todo should this check really only happen if IS_TRANSFORMATION_WRAPPER?
63 $_result = PMA_DBI_try_query(
64 'SELECT COUNT(*) FROM `' . PMA_sqlAddslashes($table, true) . '`;',
65 null, PMA_DBI_QUERY_STORE
);
66 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
67 PMA_DBI_free_result($_result);
71 $url_params = array('reload' => 1, 'db' => $db);
72 if (isset($message)) {
73 $url_params['message'] = $message;
75 if (! empty($sql_query)) {
76 $url_params['sql_query'] = $sql_query;
78 if (isset($display_query)) {
79 $url_params['display_query'] = $display_query;
81 PMA_sendHeaderLocation(
82 $cfg['PmaAbsoluteUri'] . 'db_sql.php'
83 . PMA_generate_common_url($url_params, '&'));
91 } // end if (ensures table exists)