Translated using Weblate (Czech)
[phpmyadmin.git] / db_sql_format.php
blob2d6d03fe9afe11a0b0b6517673a105382e58f5f3
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Format SQL for SQL editors
6 * @package PhpMyAdmin
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Response;
12 if (! defined('ROOT_PATH')) {
13 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
16 /**
17 * Loading common files. Used to check for authorization, localization and to
18 * load the parsing library.
20 require_once ROOT_PATH . 'libraries/common.inc.php';
22 $query = ! empty($_POST['sql']) ? $_POST['sql'] : '';
24 $query = PhpMyAdmin\SqlParser\Utils\Formatter::format($query);
26 $response = Response::getInstance();
27 $response->addJSON("sql", $query);