aboutsummaryrefslogtreecommitdiff
path: root/srcs/phpmyadmin/libraries/classes/Controllers/Database/SqlController.php
blob: 963f5bc84276e16cce3c58d0d815157f6d0a237c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Holds the PhpMyAdmin\Controllers\Database\SqlController
 * @package PhpMyAdmin\Controllers\Database
 */
declare(strict_types=1);

namespace PhpMyAdmin\Controllers\Database;

use PhpMyAdmin\Config\PageSettings;
use PhpMyAdmin\SqlQueryForm;

/**
 * Database SQL executor
 * @package PhpMyAdmin\Controllers\Database
 */
class SqlController extends AbstractController
{
    /**
     * @param array        $params       Request parameters
     * @param SqlQueryForm $sqlQueryForm SqlQueryForm instance
     *
     * @return string HTML
     */
    public function index(array $params, SqlQueryForm $sqlQueryForm): string
    {
        global $goto, $back;

        PageSettings::showGroup('Sql');

        require ROOT_PATH . 'libraries/db_common.inc.php';

        /**
         * After a syntax error, we return to this script
         * with the typed query in the textarea.
         */
        $goto = 'db_sql.php';
        $back = 'db_sql.php';

        return $sqlQueryForm->getHtml(
            true,
            false,
            isset($params['delimiter'])
                ? htmlspecialchars($params['delimiter'])
                : ';'
        );
    }
}