- Fix infinite loop bug if you use 'OR' in search

- Use case-insensitive LIKE from db capabilities
This commit is contained in:
Nathan Gray 2011-01-07 21:13:40 +00:00
parent e02abbb38f
commit e2d54119dd

View File

@ -1109,6 +1109,7 @@ class so_sql
}
elseif ($token == strtoupper(lang('OR')) || $token == 'OR')
{
$token = strtok($break);
continue;
}
elseif ($token == strtoupper(lang('NOT')) || $token == 'NOT')
@ -1153,7 +1154,7 @@ class so_sql
$op = 'OR';
break;
}
$token_filter = " $columns LIKE " .
$token_filter = " $columns " . $this->db->capabilities['case_insensitive_like'] . ' ' .
$GLOBALS['egw']->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$token).$wildcard);
// Compare numeric token as equality for numeric columns
@ -1165,7 +1166,8 @@ class so_sql
if($wildcard == '')
{
// Token has a wildcard from user, use LIKE
$numeric_filter[] = "($col IS NOT NULL AND CAST($col AS CHAR) LIKE " .
$numeric_filter[] = "($col IS NOT NULL AND CAST($col AS CHAR) " .
$this->db->capabilities['case_insensitive_like'] . ' ' .
$GLOBALS['egw']->db->quote(str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$token)) . ')';
}
else