Merge branch 'master' of github.com:phpmyadmin/phpmyadmin

This commit is contained in:
Madhura Jayaratne 2015-06-10 09:51:20 +05:30
commit 21d74afa1c
8 changed files with 87 additions and 9 deletions

View File

@ -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

View File

@ -73,6 +73,16 @@ $js_messages['strChangeColumnCollation'] = __(
. '<a href="%s" target="garbled_data_wiki">' . __('Garbled Data') . '</a>.'
. '<br/><br/>'
. __('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 <b>NOT</b> be recoverable simply '
. 'by changing back the column collation(s).'
. '<b> To convert existing data, it is suggested to use the column(s) editing feature '
. '(the "Change" Link) on the table structure page. </b>'
)
. '<br/><br/>'
. __('Are you sure you wish to change all the column collations and convert the data?');
/* For modal dialog buttons */
$js_messages['strSaveAndClose'] = __('Save & Close');

View File

@ -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');
}
});

View File

@ -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']

View File

@ -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;
}
}

View File

@ -989,6 +989,15 @@ function PMA_getTableOptionFieldset($comment, $tbl_collation,
. '</td>'
. '</tr>';
// Change all Column collations
$html_output .= '<tr><td>'
. '<label for="checkbox_change_all_collations">'
. __('Change all column collations')
. '</label></td>'
. '<td><input type="checkbox" name="change_all_collations" value="1" '
. 'id="checkbox_change_all_collations" /></td>'
. '</tr>';
if ($is_myisam_or_aria || $is_isam) {
$html_output .= PMA_getHtmlForPackKeys($pack_keys);
} // end if (MYISAM|ISAM)
@ -1909,6 +1918,30 @@ function PMA_AdjustPrivileges_copyTable($oldDb, $oldTable, $newDb, $newTable)
}
/**
* Change all collations and character sets of all columns in table
*
* @param string $db Database name
* @param string $table Table name
* @param string $tbl_collation Collation Name
*
* @return void
*/
function PMA_changeAllColumnsCollation($db, $table, $tbl_collation)
{
$GLOBALS['dbi']->selectDb($db);
$change_all_collations_query = 'ALTER TABLE ' . $table
. ' CONVERT TO';
list($charset) = explode('_', $tbl_collation);
$change_all_collations_query .= ' CHARACTER SET ' . $charset
. ($charset == $tbl_collation ? '' : ' COLLATE ' . $tbl_collation);
$GLOBALS['dbi']->query($change_all_collations_query);
}
/**
* Move or copy a table
*

View File

@ -4,8 +4,8 @@ msgstr ""
"Project-Id-Version: phpMyAdmin 4.5.0-dev\n"
"Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2015-05-31 07:27-0400\n"
"PO-Revision-Date: 2015-06-04 19:48+0200\n"
"Last-Translator: Kurt Eilertsen <kurt@kheds.com>\n"
"PO-Revision-Date: 2015-06-09 13:19+0200\n"
"Last-Translator: Børge Holm-Wennberg <borge947@gmail.com>\n"
"Language-Team: Norwegian Bokmål "
"<https://hosted.weblate.org/projects/phpmyadmin/master/nb/>\n"
"Language: nb\n"
@ -7563,7 +7563,7 @@ msgstr ""
#: libraries/config/messages.inc.php:658
#: libraries/display_create_database.lib.php:31
msgid "Database name"
msgstr "Ddatabasenavn"
msgstr "Databasenavn"
#: libraries/config/messages.inc.php:660
#, fuzzy

View File

@ -178,6 +178,16 @@ if (isset($_REQUEST['submitoptions'])) {
unset($table_alters);
$warning_messages = PMA_getWarningMessagesArray();
}
if (isset($_REQUEST['tbl_collation'])
&& ! empty($_REQUEST['tbl_collation'])
&& isset($_REQUEST['change_all_collations'])
&& ! empty($_REQUEST['change_all_collations'])
) {
PMA_changeAllColumnsCollation(
$GLOBALS['db'], $GLOBALS['table'], $_REQUEST['tbl_collation']
);
}
}
/**
* Reordering the table has been requested by the user