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')) {
18 $is_db = @PMA_DBI_select_db
($db);
24 // not a valid db name -> back to the welcome page
25 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
26 $url_params = array('reload' => 1);
27 if (isset($message)) {
28 $url_params['message'] = $message;
30 if (! empty($sql_query)) {
31 $url_params['sql_query'] = $sql_query;
33 if (isset($show_as_php)) {
34 $url_params['show_as_php'] = $show_as_php;
36 PMA_sendHeaderLocation(
37 $cfg['PmaAbsoluteUri'] . 'main.php'
38 . PMA_generate_common_url($url_params, '&'));
42 } // end if (ensures db exists)
44 if (empty($is_table) && !defined('PMA_SUBMIT_MULT')) {
45 // Not a valid table name -> back to the db_sql.php
47 $_result = PMA_DBI_try_query(
48 'SHOW TABLES LIKE \'' . PMA_sqlAddslashes($table, true) . '\';',
49 null, PMA_DBI_QUERY_STORE
);
50 $is_table = @PMA_DBI_num_rows
($_result);
51 PMA_DBI_free_result($_result);
57 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
59 // SHOW TABLES doesn't show temporary tables, so try select
60 // (as it can happen just in case temporary table, it should be
64 * @todo should this check really only happen if IS_TRANSFORMATION_WRAPPER?
66 $_result = PMA_DBI_try_query(
67 'SELECT COUNT(*) FROM ' . PMA_backquote($table) . ';',
68 null, PMA_DBI_QUERY_STORE
);
69 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
70 PMA_DBI_free_result($_result);
74 $url_params = array('reload' => 1, 'db' => $db);
75 if (isset($message)) {
76 $url_params['message'] = $message;
78 if (! empty($sql_query)) {
79 $url_params['sql_query'] = $sql_query;
81 if (isset($display_query)) {
82 $url_params['display_query'] = $display_query;
84 PMA_sendHeaderLocation(
85 $cfg['PmaAbsoluteUri'] . 'db_sql.php'
86 . PMA_generate_common_url($url_params, '&'));
94 } // end if (ensures table exists)