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$
$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>
* lang/spanish: Updated, thanks to Daniel Hinostroza (hinostroza)
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)
*
* @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)
{
@@ -83,14 +83,16 @@ if (isset($submit_search)) {
for ($i = 0; $i < $search_wds_cnt; $i++) {
// 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])) {
for ($j = 0; $j < $tblfields_cnt; $j++) {
$prefix = PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL'
? 'CONVERT(_utf8 '
: '';
$suffix = PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL'
? ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation']
: '';
if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' && $tblfields[$j]['Charset'] != '') {
$prefix = 'CONVERT(_utf8 ';
$suffix = ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation'];
} else {
$prefix = $suffix = '';
}
$thefieldlikevalue[] = $tblfields[$j]['Field']
. ' ' . $like_or_regex . ' '
. $prefix