Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
465a9ed5f2
@ -29,7 +29,9 @@ require_once 'libraries/Util.class.php';
|
||||
|
||||
$container = DI\Container::getDefaultContainer();
|
||||
$container->factory('PMA\Controllers\Table\TableRelationController');
|
||||
$container->alias('TableRelationController', 'PMA\Controllers\Table\TableRelationController');
|
||||
$container->alias(
|
||||
'TableRelationController', 'PMA\Controllers\Table\TableRelationController'
|
||||
);
|
||||
|
||||
/* Define dependencies for the concerned controller */
|
||||
$db = $container->get('db');
|
||||
@ -59,10 +61,14 @@ $dependency_definitions = array(
|
||||
"upd_query" => $upd_query
|
||||
);
|
||||
if ($cfgRelation['relwork']) {
|
||||
$dependency_definitions['existrel'] = PMA_getForeigners($db, $table, '', 'internal');
|
||||
$dependency_definitions['existrel'] = PMA_getForeigners(
|
||||
$db, $table, '', 'internal'
|
||||
);
|
||||
}
|
||||
if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
|
||||
$dependency_definitions['existrel_foreign'] = PMA_getForeigners($db, $table, '', 'foreign');
|
||||
$dependency_definitions['existrel_foreign'] = PMA_getForeigners(
|
||||
$db, $table, '', 'foreign'
|
||||
);
|
||||
}
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$dependency_definitions['disp'] = PMA_getDisplayField($db, $table);
|
||||
|
||||
@ -182,7 +182,8 @@ function PMA_changePassUrlParamsAndSubmitQuery(
|
||||
} else {
|
||||
$local_query = 'SET password = ' . (($password == '')
|
||||
? '\'\''
|
||||
: $hashing_function . '(\'' . PMA_Util::sqlAddSlashes($password) . '\')');
|
||||
: $hashing_function . '(\'' . PMA_Util::sqlAddSlashes($password)
|
||||
. '\')');
|
||||
}
|
||||
if (! @$GLOBALS['dbi']->tryQuery($local_query)) {
|
||||
PMA_Util::mysqlDie($GLOBALS['dbi']->getError(), $sql_query, false, $err_url);
|
||||
|
||||
117
view_create.php
117
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']);
|
||||
}
|
||||
|
||||
$column_map = $GLOBALS['dbi']->getColumnMapFromSql(
|
||||
$_REQUEST['view']['as'], $view_columns
|
||||
);
|
||||
$pma_transformation_data = $GLOBALS['dbi']->getSystemDatabase()->getExistingTransformationData(
|
||||
$GLOBALS['db']
|
||||
);
|
||||
|
||||
if ($pma_transformation_data !== false) {
|
||||
|
||||
// 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']
|
||||
);
|
||||
|
||||
// Store new transformations
|
||||
if ($new_transformations_sql != '') {
|
||||
$GLOBALS['dbi']->tryQuery($new_transformations_sql);
|
||||
}
|
||||
|
||||
}
|
||||
unset($pma_transformation_data);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
} else {
|
||||
if (!$GLOBALS['dbi']->tryQuery($sql_query)) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
$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 different column names defined for VIEW
|
||||
$view_columns = array();
|
||||
if (isset($_REQUEST['view']['column_names'])) {
|
||||
$view_columns = explode(',', $_REQUEST['view']['column_names']);
|
||||
}
|
||||
|
||||
$column_map = $GLOBALS['dbi']->getColumnMapFromSql(
|
||||
$_REQUEST['view']['as'], $view_columns
|
||||
);
|
||||
|
||||
$systemDb = $GLOBALS['dbi']->getSystemDatabase();
|
||||
$pma_transformation_data = $systemDb->getExistingTransformationData(
|
||||
$GLOBALS['db']
|
||||
);
|
||||
|
||||
if ($pma_transformation_data !== false) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
}
|
||||
unset($pma_transformation_data);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// prefill values if not already filled from former submission
|
||||
|
||||
Loading…
Reference in New Issue
Block a user