Merge pull request #1764 from devenbansod/rfe946_correction

Few fixes related RFE#946 & RFE#657 - PR #1686 &  PR #1664
This commit is contained in:
Isaac Bennetch 2015-06-29 16:01:51 -04:00
commit b3a8759ebe
2 changed files with 36 additions and 32 deletions

View File

@ -108,33 +108,6 @@ AJAX.registerOnload('tbl_structure.js', function () {
var $form = $(this);
var field_cnt = $form.find('input[name=orig_num_fields]').val();
/*
* First validate the form; if there is a problem, avoid submitting it
*
* checkTableEditForm() needs a pure element and not a jQuery object,
* this is why we pass $form[0] as a parameter (the jQuery object
* is actually an array of DOM elements)
*/
if (checkTableEditForm($form[0], field_cnt)) {
// OK, form passed validation step
PMA_prepareForAjaxRequest($form);
if (PMA_checkReservedWordColumns($form)) {
//User wants to submit the form
// If Collation is changed, Warn and Confirm
if (checkIfConfirmRequired($form, field_cnt)){
var question = sprintf(
PMA_messages.strChangeColumnCollation, 'http://wiki.phpmyadmin.net/pma/Garbled_data'
);
$form.PMA_confirm(question, $form.attr('action'), function (url) {
submitForm();
});
} else {
submitForm();
}
}
}
function submitForm(){
$msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest);
@ -181,6 +154,34 @@ AJAX.registerOnload('tbl_structure.js', function () {
}
return checkRequired;
}
/*
* First validate the form; if there is a problem, avoid submitting it
*
* checkTableEditForm() needs a pure element and not a jQuery object,
* this is why we pass $form[0] as a parameter (the jQuery object
* is actually an array of DOM elements)
*/
if (checkTableEditForm($form[0], field_cnt)) {
// OK, form passed validation step
PMA_prepareForAjaxRequest($form);
if (PMA_checkReservedWordColumns($form)) {
//User wants to submit the form
// If Collation is changed, Warn and Confirm
if (checkIfConfirmRequired($form, field_cnt)){
var question = sprintf(
PMA_messages.strChangeColumnCollation, 'http://wiki.phpmyadmin.net/pma/Garbled_data'
);
$form.PMA_confirm(question, $form.attr('action'), function (url) {
submitForm();
});
} else {
submitForm();
}
}
}
}); // end change table button "do_save_data"
/**

View File

@ -2596,6 +2596,7 @@ function PMA_updateColumns($db, $table)
if (isset($_REQUEST['field_adjust_privileges'][$i])
&& ! empty($_REQUEST['field_adjust_privileges'][$i])
&& $_REQUEST['field_orig'][$i] != $_REQUEST['field_name'][$i]
) {
$adjust_privileges[$_REQUEST['field_orig'][$i]] = $_REQUEST['field_name'][$i];
}
@ -2644,8 +2645,8 @@ function PMA_updateColumns($db, $table)
&& $_REQUEST['field_collation'][$i] !== $_REQUEST['field_collation_orig'][$i]
) {
$secondary_query = 'ALTER TABLE ' . PMA_Util::backquote($table)
. ' CHANGE ' . PMA_Util::backquote($_REQUEST['field_name'][$i])
. ' ' . PMA_Util::backquote($_REQUEST['field_name'][$i])
. ' CHANGE ' . PMA_Util::backquote($_REQUEST['field_orig'][$i])
. ' ' . PMA_Util::backquote($_REQUEST['field_orig'][$i])
. ' BLOB;';
$GLOBALS['dbi']->query($secondary_query);
$changedToBlob[$i] = true;
@ -2799,9 +2800,11 @@ function PMA_adjustColumnPrivileges($db, $table, $adjust_privileges)
$changed = true;
}
// Finally FLUSH the new privileges
$flushPrivQuery = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flushPrivQuery);
if ($changed) {
// Finally FLUSH the new privileges
$flushPrivQuery = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flushPrivQuery);
}
return $changed;
}