diff options
author | Nisarg Jhaveri <nisargjhaveri@gmail.com> | 2015-01-06 10:59:43 +0300 |
---|---|---|
committer | Nisarg Jhaveri <nisargjhaveri@gmail.com> | 2015-01-06 10:59:43 +0300 |
commit | 8f04eed7772170e9cacc7546047f9c6153684c29 (patch) | |
tree | 4187ed99ebc35bcd073de9b875544f64bba28eb2 /db_sql_format.php | |
parent | 5f815f4844768737e5998bd4182351fabe5ee50f (diff) |
SQL formatting with sql-formatter
Signed-off-by: Nisarg Jhaveri <nisargjhaveri@gmail.com>
Diffstat (limited to 'db_sql_format.php')
-rw-r--r-- | db_sql_format.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db_sql_format.php b/db_sql_format.php new file mode 100644 index 0000000000..a83e5273ee --- /dev/null +++ b/db_sql_format.php @@ -0,0 +1,18 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * Format SQL for SQL editors + * + * @package PhpMyAdmin + */ + +require_once 'libraries/common.inc.php'; +require_once 'libraries/sql-formatter/lib/SqlFormatter.php'; + +$query = isset($_POST['sql']) ? $_POST['sql'] : ''; + +SqlFormatter::$tab = "\t"; +$query = SqlFormatter::format($query, false); + +$response = PMA_Response::getInstance(); +$response->addJSON("sql", $query); |