new egw_db::capabilities['case_insensitive_like']=='LIKE' ('ILIKE' for Postgres) used for all so_sql search and the lettersearch in addressbook

This commit is contained in:
Ralf Becker 2006-12-17 08:44:05 +00:00
parent 123a86b2b8
commit f4238614f3
3 changed files with 12 additions and 10 deletions

View File

@ -628,8 +628,8 @@ class uicontacts extends bocontacts
}
if ($query['searchletter']) // only show contacts if the order-criteria starts with the given letter
{
$query['col_filter'][] = ($query['order']=='adr_one_postalcode' ? 'org_name' : $query['order']).
' LIKE '.$GLOBALS['egw']->db->quote($query['searchletter'].'%');
$query['col_filter'][] = ($query['order'] == 'adr_one_postalcode' ? 'org_name' : $query['order']).' '.
$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.$GLOBALS['egw']->db->quote($query['searchletter'].'%');
}
$wildcard = '%';
$op = 'OR';

View File

@ -517,10 +517,10 @@ class so_sql
if ($wildcard || $criteria[$col]{0} == '!' ||
is_string($criteria[$col]) && (strpos($criteria[$col],'*')!==false || strpos($criteria[$col],'?')!==false))
{
$cmp_op = ' LIKE ';
$cmp_op = ' '.$this->db->capabilities['case_insensitive_like'].' ';
if ($criteria[$col]{0} == '!')
{
$cmp_op = ' NOT LIKE ';
$cmp_op = ' NOT'.$cmp_op;
$criteria[$col] = substr($criteria[$col],1);
}
$query[] = $db_col.$cmp_op.$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$criteria[$col]).$wildcard);

View File

@ -126,6 +126,7 @@
'like_on_text' => true, // is the DB able to use LIKE with text columns
'name_case' => 'upper', // case of returned column- and table-names: upper, lower(pgSql), preserv(MySQL)
'client_encoding' => false, // db uses a changeable clientencoding
'case_insensitive_like' => 'LIKE', // case insensitive version of like, eg. ILIKE for postgres
'order_on_text' => true, // is the DB able to order by a given text column, boolean or
); // string for sprintf for a cast (eg. 'CAST(%s AS varchar)')
@ -341,6 +342,7 @@
$this->capabilities['name_case'] = 'lower';
$this->capabilities['client_encoding'] = (float) $db_version >= 7.4;
$this->capabilities['outer_join'] = true;
$this->capabilities['case_insensitive_like'] = 'ILIKE';
break;
case 'mssql':