phpmyadmin/libraries/entry_points/database/sql/format.php
Maurício Meneghini Fauth f0a1762f78 Use the router for the SQL autocomplete and format
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2019-08-07 18:16:07 -03:00

22 lines
399 B
PHP

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Format SQL for SQL editors
*
* @package PhpMyAdmin
*/
declare(strict_types=1);
use PhpMyAdmin\Response;
if (! defined('PHPMYADMIN')) {
exit;
}
$query = ! empty($_POST['sql']) ? $_POST['sql'] : '';
$query = PhpMyAdmin\SqlParser\Utils\Formatter::format($query);
$response = Response::getInstance();
$response->addJSON("sql", $query);