2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Format SQL for SQL editors
8 declare(strict_types
=1);
10 use PhpMyAdmin\Response
;
12 if (! defined('ROOT_PATH')) {
13 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
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);