diff --git a/ChangeLog b/ChangeLog
index efd612a7cb..69e7b8d8fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@ phpMyAdmin - ChangeLog
+ rfe Remove support for Shift + Click on function name to apply to all rows in insert/edit page
+ rfe #1634 Don't group tables in tree if the result has only one group
- bug #4946 When hide table structure actions is false, action should be in a row
++ rfe #726 Batch changing the collation of each column in a table
4.4.10.0 (not yet released)
- bug #4950 Issues in database selection for replication
diff --git a/js/messages.php b/js/messages.php
index 3ba1f8d20d..90256329b4 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -73,6 +73,16 @@ $js_messages['strChangeColumnCollation'] = __(
. '' . __('Garbled Data') . '.'
. '
'
. __('Are you sure you wish to change the collation and convert the data?');
+$js_messages['strChangeAllColumnCollationsWarning'] = __(
+ 'Through this operation, MySQL attempts to map the data values between collations. '
+ . 'If the character sets are incompatible, '
+ . 'there may be data loss and this lost data may NOT be recoverable simply '
+ . 'by changing back the column collation(s).'
+ . ' To convert existing data, it is suggested to use the column(s) editing feature '
+ . '(the "Change" Link) on the table structure page. '
+)
+. '
'
+. __('Are you sure you wish to change all the column collations and convert the data?');
/* For modal dialog buttons */
$js_messages['strSaveAndClose'] = __('Save & Close');
diff --git a/js/tbl_operations.js b/js/tbl_operations.js
index 9665eb2d9b..781f0d5b83 100644
--- a/js/tbl_operations.js
+++ b/js/tbl_operations.js
@@ -78,10 +78,35 @@ AJAX.registerOnload('tbl_operations.js', function () {
event.stopPropagation();
var $form = $(this);
var $tblNameField = $form.find('input[name=new_name]');
+ var $tblCollationField = $form.find('select[name=tbl_collation]');
+ var collationOrigValue = $('select[name="tbl_collation"] option[selected]').val();
+ var $changeAllColumnCollationsCheckBox = $('#checkbox_change_all_collations');
+ var question = PMA_messages.strChangeAllColumnCollationsWarning;
+
if ($tblNameField.val() !== $tblNameField[0].defaultValue) {
// reload page and navigation if the table has been renamed
PMA_prepareForAjaxRequest($form);
var tbl = $tblNameField.val();
+
+ if ($tblCollationField.val() !== collationOrigValue && $changeAllColumnCollationsCheckBox.is(':checked')) {
+ $form.PMA_confirm(question, $form.attr('action'), function (url) {
+ submitOptionsForm();
+ });
+ } else {
+ submitOptionsForm();
+ }
+ } else {
+
+ if ($tblCollationField.val() !== collationOrigValue && $changeAllColumnCollationsCheckBox.is(':checked')) {
+ $form.PMA_confirm(question, $form.attr('action'), function (url) {
+ $form.removeClass('ajax').submit().addClass('ajax');
+ });
+ } else {
+ $form.removeClass('ajax').submit().addClass('ajax');
+ }
+ }
+
+ function submitOptionsForm() {
$.post($form.attr('action'), $form.serialize(), function (data) {
if (typeof data !== 'undefined' && data.success === true) {
PMA_commonParams.set('table', tbl);
@@ -93,8 +118,6 @@ AJAX.registerOnload('tbl_operations.js', function () {
PMA_ajaxShowMessage(data.error, false);
}
}); // end $.post()
- } else {
- $form.removeClass('ajax').submit().addClass('ajax');
}
});
diff --git a/libraries/Console.class.php b/libraries/Console.class.php
index 1b3b86ccd6..4074effce1 100644
--- a/libraries/Console.class.php
+++ b/libraries/Console.class.php
@@ -164,7 +164,7 @@ class PMA_Console
$output = '';
$_sql_history = PMA_getHistory($GLOBALS['cfg']['Server']['user']);
- if ($_sql_history) {
+ if (! empty($_sql_history)) {
foreach (array_reverse($_sql_history) as $record) {
$isSelect = preg_match(
'@^SELECT[[:space:]]+@i', $record['sqlquery']
diff --git a/libraries/insert_edit.lib.php b/libraries/insert_edit.lib.php
index ec805ab8b9..f2394e82c3 100644
--- a/libraries/insert_edit.lib.php
+++ b/libraries/insert_edit.lib.php
@@ -1497,11 +1497,12 @@ function PMA_getAfterInsertDropDown($where_clause, $after_insert, $found_unique_
$where_clause = array($where_clause);
}
for ($i = 0, $nb = count($where_clause); $i < $nb; $i++) {
- $is_numeric = preg_match(
+ // preg_match() returns 1 if there is a match
+ $is_numeric = (preg_match(
'@^[\s]*`[^`]*`[\.]`[^`]*` = [0-9]+@',
$where_clause[$i]
- );
- if ($is_numeric == true) {
+ ) == 1);
+ if ($is_numeric === true) {
break;
}
}
diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php
index 58f012497d..6f404d5763 100644
--- a/libraries/operations.lib.php
+++ b/libraries/operations.lib.php
@@ -989,6 +989,15 @@ function PMA_getTableOptionFieldset($comment, $tbl_collation,
. ''
. '';
+ // Change all Column collations
+ $html_output .= '