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 = @$GLOBALS['dbi']->selectDb($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_URL_getCommon($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 = $GLOBALS['dbi']->tryQuery(
62 'SHOW TABLES LIKE \'' . PMA_Util
::sqlAddSlashes($table, true)
64 null, PMA_DatabaseInterface
::QUERY_STORE
66 $is_table = @$GLOBALS['dbi']->numRows($_result);
67 $GLOBALS['dbi']->freeResult($_result);
74 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
76 // SHOW TABLES doesn't show temporary tables, so try select
77 // (as it can happen just in case temporary table, it should be
81 * @todo should this check really
82 * only happen if IS_TRANSFORMATION_WRAPPER?
84 $_result = $GLOBALS['dbi']->tryQuery(
85 'SELECT COUNT(*) FROM ' . PMA_Util
::backquote($table) . ';',
87 PMA_DatabaseInterface
::QUERY_STORE
89 $is_table = ($_result && @$GLOBALS['dbi']->numRows($_result));
90 $GLOBALS['dbi']->freeResult($_result);
94 include './db_sql.php';
103 } // end if (ensures table exists)