diff options
author | Hugues Peccatte <hugues.peccatte@gmail.com> | 2015-07-22 23:08:24 +0300 |
---|---|---|
committer | Hugues Peccatte <hugues.peccatte@gmail.com> | 2015-07-22 23:08:24 +0300 |
commit | a1cf9a24e35f7c44444eb65bc88a95d695bfb9e1 (patch) | |
tree | 2fce48d00c86002d89148a7b8d0462fc3ff1d5c6 /view_create.php | |
parent | 86a4c3e32dcc2caea0d0f8a680fcf528a5f400a0 (diff) |
Coding style modification.
Make PHPCS happy.
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Diffstat (limited to 'view_create.php')
-rw-r--r-- | view_create.php | 99 |
1 files changed, 49 insertions, 50 deletions
diff --git a/view_create.php b/view_create.php index 33c9bc8cf6..5ea2aa3364 100644 --- a/view_create.php +++ b/view_create.php @@ -83,69 +83,68 @@ if (isset($_REQUEST['createview']) || isset($_REQUEST['alterview'])) { } } - if ($GLOBALS['dbi']->tryQuery($sql_query)) { - - // If different column names defined for VIEW - $view_columns = array(); - if (isset($_REQUEST['view']['column_names'])) { - $view_columns = explode(',', $_REQUEST['view']['column_names']); + if (!$GLOBALS['dbi']->tryQuery($sql_query)) { + if (! isset($_REQUEST['ajax_dialog'])) { + $message = PMA_Message::rawError($GLOBALS['dbi']->getError()); + return; } - $column_map = $GLOBALS['dbi']->getColumnMapFromSql( - $_REQUEST['view']['as'], $view_columns - ); - $pma_transformation_data = $GLOBALS['dbi']->getSystemDatabase()->getExistingTransformationData( - $GLOBALS['db'] + $response = PMA_Response::getInstance(); + $response->addJSON( + 'message', + PMA_Message::error( + "<i>" . htmlspecialchars($sql_query) . "</i><br /><br />" + . $GLOBALS['dbi']->getError() + ) ); + $response->isSuccess(false); + exit; + } - if ($pma_transformation_data !== false) { + // If different column names defined for VIEW + $view_columns = array(); + if (isset($_REQUEST['view']['column_names'])) { + $view_columns = explode(',', $_REQUEST['view']['column_names']); + } - // SQL for store new transformation details of VIEW - $new_transformations_sql = $GLOBALS['dbi']->getSystemDatabase()->getNewTransformationDataSql( - $pma_transformation_data, $column_map, - $_REQUEST['view']['name'], $GLOBALS['db'] - ); + $column_map = $GLOBALS['dbi']->getColumnMapFromSql( + $_REQUEST['view']['as'], $view_columns + ); - // Store new transformations - if ($new_transformations_sql != '') { - $GLOBALS['dbi']->tryQuery($new_transformations_sql); - } + $systemDb = $GLOBALS['dbi']->getSystemDatabase(); + $pma_transformation_data = $systemDb->getExistingTransformationData( + $GLOBALS['db'] + ); - } - unset($pma_transformation_data); + if ($pma_transformation_data !== false) { - if (! isset($_REQUEST['ajax_dialog'])) { - $message = PMA_Message::success(); - include 'tbl_structure.php'; - } else { - $response = PMA_Response::getInstance(); - $response->addJSON( - 'message', - PMA_Util::getMessage( - PMA_Message::success(), $sql_query - ) - ); - $response->isSuccess(true); + // SQL for store new transformation details of VIEW + $new_transformations_sql = $systemDb->getNewTransformationDataSql( + $pma_transformation_data, $column_map, + $_REQUEST['view']['name'], $GLOBALS['db'] + ); + + // Store new transformations + if ($new_transformations_sql != '') { + $GLOBALS['dbi']->tryQuery($new_transformations_sql); } - exit; + } + unset($pma_transformation_data); + if (! isset($_REQUEST['ajax_dialog'])) { + $message = PMA_Message::success(); + include 'tbl_structure.php'; } else { - if (! isset($_REQUEST['ajax_dialog'])) { - $message = PMA_Message::rawError($GLOBALS['dbi']->getError()); - } else { - $response = PMA_Response::getInstance(); - $response->addJSON( - 'message', - PMA_Message::error( - "<i>" . htmlspecialchars($sql_query) . "</i><br /><br />" - . $GLOBALS['dbi']->getError() - ) - ); - $response->isSuccess(false); - exit; - } + $response = PMA_Response::getInstance(); + $response->addJSON( + 'message', + PMA_Util::getMessage(PMA_Message::success(), $sql_query) + ); + $response->isSuccess(true); } + + exit; } // prefill values if not already filled from former submission |