You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
487 B
23 lines
487 B
2 years ago
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace PhpMyAdmin\Controllers\Database;
|
||
|
|
||
|
use PhpMyAdmin\SqlParser\Utils\Formatter;
|
||
|
|
||
|
use function strlen;
|
||
|
|
||
|
/**
|
||
|
* Format SQL for SQL editors.
|
||
|
*/
|
||
|
class SqlFormatController extends AbstractController
|
||
|
{
|
||
|
public function __invoke(): void
|
||
|
{
|
||
|
$params = ['sql' => $_POST['sql'] ?? null];
|
||
|
$query = strlen((string) $params['sql']) > 0 ? $params['sql'] : '';
|
||
|
$this->response->addJSON(['sql' => Formatter::format($query)]);
|
||
|
}
|
||
|
}
|