bug #1233349 db search in MySQL 5.0.x on fields without a charset

This commit is contained in:
Marc Delisle
2005-07-07 01:21:41 +00:00
parent 54e2491841
commit 5712184a31
2 changed files with 13 additions and 7 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-07-06 Marc Delisle <lem9@users.sourceforge.net>
* db_search.php: bug #1233349, db search in MySQL 5.0.x on fields
without a charset
2005-07-04 Marc Delisle <lem9@users.sourceforge.net> 2005-07-04 Marc Delisle <lem9@users.sourceforge.net>
* lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza) * lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza)
and Mastermnd for the 2.6.2 translation cleanup and Mastermnd for the 2.6.2 translation cleanup

View File

@@ -46,7 +46,7 @@ if (isset($submit_search)) {
* *
* @return array 3 SQL querys (for count, display and delete results) * @return array 3 SQL querys (for count, display and delete results)
* *
* @global string the url to retun to in case of errors * @global string the url to return to in case of errors
*/ */
function PMA_getSearchSqls($table, $search_str, $search_option) function PMA_getSearchSqls($table, $search_str, $search_option)
{ {
@@ -83,14 +83,16 @@ if (isset($submit_search)) {
for ($i = 0; $i < $search_wds_cnt; $i++) { for ($i = 0; $i < $search_wds_cnt; $i++) {
// Eliminates empty values // Eliminates empty values
// In MySQL 4.1, if a field has no collation we get NULL in Charset
// but in MySQL 5.0.x we get ''
if (!empty($search_words[$i])) { if (!empty($search_words[$i])) {
for ($j = 0; $j < $tblfields_cnt; $j++) { for ($j = 0; $j < $tblfields_cnt; $j++) {
$prefix = PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' && $tblfields[$j]['Charset'] != '') {
? 'CONVERT(_utf8 ' $prefix = 'CONVERT(_utf8 ';
: ''; $suffix = ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation'];
$suffix = PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' } else {
? ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation'] $prefix = $suffix = '';
: ''; }
$thefieldlikevalue[] = $tblfields[$j]['Field'] $thefieldlikevalue[] = $tblfields[$j]['Field']
. ' ' . $like_or_regex . ' ' . ' ' . $like_or_regex . ' '
. $prefix . $prefix