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 $response = PMA_Response
::getInstance();
24 if ($response->isAjax()) {
25 $response->isSuccess(false);
28 PMA_Message
::error(__('No databases selected.'))
31 $url_params = array('reload' => 1);
32 if (isset($message)) {
33 $url_params['message'] = $message;
35 if (! empty($sql_query)) {
36 $url_params['sql_query'] = $sql_query;
38 if (isset($show_as_php)) {
39 $url_params['show_as_php'] = $show_as_php;
41 PMA_sendHeaderLocation(
42 $cfg['PmaAbsoluteUri'] . 'index.php'
43 . PMA_generate_common_url($url_params, '&')
49 } // end if (ensures db exists)
52 && !defined('PMA_SUBMIT_MULT')
53 && ! defined('TABLE_MAY_BE_ABSENT')
55 // Not a valid table name -> back to the db_sql.php
58 $is_table = isset(PMA_Table
::$cache[$db][$table]);
61 $_result = PMA_DBI_try_query(
62 'SHOW TABLES LIKE \'' . PMA_Util
::sqlAddSlashes($table, true) . '\';',
63 null, PMA_DBI_QUERY_STORE
65 $is_table = @PMA_DBI_num_rows
($_result);
66 PMA_DBI_free_result($_result);
73 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
75 // SHOW TABLES doesn't show temporary tables, so try select
76 // (as it can happen just in case temporary table, it should be
80 * @todo should this check really
81 * only happen if IS_TRANSFORMATION_WRAPPER?
83 $_result = PMA_DBI_try_query(
84 'SELECT COUNT(*) FROM ' . PMA_Util
::backquote($table) . ';',
88 $is_table = ($_result && @PMA_DBI_num_rows
($_result));
89 PMA_DBI_free_result($_result);
93 include './db_sql.php';
102 } // end if (ensures table exists)