From 4232fcd458b70913a08240897cde0073c6e78959 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 10 Sep 2011 10:47:37 +0530 Subject: [PATCH 1/3] bug #3403165 [interface] Collation not displayed for long enum fields --- ChangeLog | 1 + tbl_structure.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7566511064..9949461c59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog 3.4.6.0 (not yet released) - patch #3404173 InnoDB comment display with tooltips/aliases - bug #3404886 [navi] Edit SQL statement after error +- bug #3403165 [interface] Collation not displayed for long enum fields 3.4.5.0 (not yet released) - bug #3375325 [interface] Page list in navigation frame looks odd diff --git a/tbl_structure.php b/tbl_structure.php index 4c0b1856b9..8e7e5cd907 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -245,6 +245,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { $type = $row['Type']; $extracted_fieldspec = PMA_extractFieldSpec($row['Type']); + $truncated = false; if ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type']) { $type = $extracted_fieldspec['type'] . '(' . str_replace("','", "', '", $extracted_fieldspec['spec_in_brackets']) . ')'; @@ -252,6 +253,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { // for the case ENUM('–','“') $type = htmlspecialchars($type); if(strlen($type) > $GLOBALS['cfg']['LimitChars']) { + $truncated = true; $type = '' . substr($type, 0, $GLOBALS['cfg']['LimitChars']) . ''; } @@ -292,6 +294,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { || substr($type, 0, 8) == 'longtext' || substr($type, 0, 3) == 'set' || substr($type, 0, 4) == 'enum' + || ($truncated && substr($type, 13, 4) == 'enum') ) && !$binary) { if (strpos($type, ' character set ')) { $type = substr($type, 0, strpos($type, ' character set ')); From 5a82da9ad352dede10c4b78cafb055a246e7af5f Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 10 Sep 2011 10:49:44 +0530 Subject: [PATCH 2/3] Coding style --- tbl_structure.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tbl_structure.php b/tbl_structure.php index 8e7e5cd907..246bd0e4da 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -294,8 +294,9 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { || substr($type, 0, 8) == 'longtext' || substr($type, 0, 3) == 'set' || substr($type, 0, 4) == 'enum' - || ($truncated && substr($type, 13, 4) == 'enum') - ) && !$binary) { + || ($truncated && substr($type, 13, 4) == 'enum')) + && !$binary + ) { if (strpos($type, ' character set ')) { $type = substr($type, 0, strpos($type, ' character set ')); } From eeeba849c37de3932fc6ecee5958901cfbc07cb0 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sat, 10 Sep 2011 11:28:02 +0530 Subject: [PATCH 3/3] Fix for bug #3403165 for 3.5 branch --- tbl_structure.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tbl_structure.php b/tbl_structure.php index c7c0c25ae8..15771110e5 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -260,19 +260,21 @@ foreach ($fields as $row) { // for the case ENUM('–','“') $type = htmlspecialchars($type); // in case it is too long + $start = 0; if (strlen($type) > $GLOBALS['cfg']['LimitChars']) { + $start = 13; $type = '' . substr($type, 0, $GLOBALS['cfg']['LimitChars']) . ''; } unset($field_charset); - if ((substr($type, 0, 4) == 'char' - || substr($type, 0, 7) == 'varchar' - || substr($type, 0, 4) == 'text' - || substr($type, 0, 8) == 'tinytext' - || substr($type, 0, 10) == 'mediumtext' - || substr($type, 0, 8) == 'longtext' - || substr($type, 0, 3) == 'set' - || substr($type, 0, 4) == 'enum') + if ((substr($type, $start, 4) == 'char' + || substr($type, $start, 7) == 'varchar' + || substr($type, $start, 4) == 'text' + || substr($type, $start, 8) == 'tinytext' + || substr($type, $start, 10) == 'mediumtext' + || substr($type, $start, 8) == 'longtext' + || substr($type, $start, 3) == 'set' + || substr($type, $start, 4) == 'enum') && !$extracted_fieldspec['binary'] ) { if (strpos($type, ' character set ')) {