db_sql_format.php 485 B

123456789101112131415161718192021
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Format SQL for SQL editors
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. use PhpMyAdmin\Response;
  9. /**
  10. * Loading common files. Used to check for authorization, localization and to
  11. * load the parsing library.
  12. */
  13. require_once 'libraries/common.inc.php';
  14. $query = !empty($_POST['sql']) ? $_POST['sql'] : '';
  15. $query = PhpMyAdmin\SqlParser\Utils\Formatter::format($query);
  16. $response = Response::getInstance();
  17. $response->addJSON("sql", $query);