2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Ensure the database and the table exist (else move to the "parent" script)
11 use PhpMyAdmin\Message
;
12 use PhpMyAdmin\Response
;
15 if (! defined('PHPMYADMIN')) {
20 if (strlen($db) > 0) {
21 $is_db = @$GLOBALS['dbi']->selectDb($db);
27 // not a valid db name -> back to the welcome page
28 if (! defined('IS_TRANSFORMATION_WRAPPER')) {
29 $response = Response
::getInstance();
30 if ($response->isAjax()) {
31 $response->setRequestStatus(false);
34 Message
::error(__('No databases selected.'))
37 $url_params = array('reload' => 1);
38 if (isset($message)) {
39 $url_params['message'] = $message;
41 if (! empty($sql_query)) {
42 $url_params['sql_query'] = $sql_query;
44 if (isset($show_as_php)) {
45 $url_params['show_as_php'] = $show_as_php;
47 Core
::sendHeaderLocation(
49 . Url
::getCommonRaw($url_params)
55 } // end if (ensures db exists)
58 && !defined('PMA_SUBMIT_MULT')
59 && !defined('TABLE_MAY_BE_ABSENT')
61 // Not a valid table name -> back to the db_sql.php
63 if (strlen($table) > 0) {
64 $is_table = $GLOBALS['dbi']->getCachedTableContent(array($db, $table), false);
67 $_result = $GLOBALS['dbi']->tryQuery(
69 . $GLOBALS['dbi']->escapeString($table) . '\';',
70 PhpMyAdmin\DatabaseInterface
::CONNECT_USER
,
71 PhpMyAdmin\DatabaseInterface
::QUERY_STORE
73 $is_table = @$GLOBALS['dbi']->numRows($_result);
74 $GLOBALS['dbi']->freeResult($_result);
81 if (!defined('IS_TRANSFORMATION_WRAPPER')) {
82 if (strlen($table) > 0) {
83 // SHOW TABLES doesn't show temporary tables, so try select
84 // (as it can happen just in case temporary table, it should be
88 * @todo should this check really
89 * only happen if IS_TRANSFORMATION_WRAPPER?
91 $_result = $GLOBALS['dbi']->tryQuery(
92 'SELECT COUNT(*) FROM ' . PhpMyAdmin\Util
::backquote($table)
94 PhpMyAdmin\DatabaseInterface
::CONNECT_USER
,
95 PhpMyAdmin\DatabaseInterface
::QUERY_STORE
97 $is_table = ($_result && @$GLOBALS['dbi']->numRows($_result));
98 $GLOBALS['dbi']->freeResult($_result);
102 include './db_sql.php';
111 } // end if (ensures table exists)