forked from extern/egroupware
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:
parent
123a86b2b8
commit
f4238614f3
@ -628,8 +628,8 @@ class uicontacts extends bocontacts
|
|||||||
}
|
}
|
||||||
if ($query['searchletter']) // only show contacts if the order-criteria starts with the given letter
|
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']).
|
$query['col_filter'][] = ($query['order'] == 'adr_one_postalcode' ? 'org_name' : $query['order']).' '.
|
||||||
' LIKE '.$GLOBALS['egw']->db->quote($query['searchletter'].'%');
|
$GLOBALS['egw']->db->capabilities['case_insensitive_like'].' '.$GLOBALS['egw']->db->quote($query['searchletter'].'%');
|
||||||
}
|
}
|
||||||
$wildcard = '%';
|
$wildcard = '%';
|
||||||
$op = 'OR';
|
$op = 'OR';
|
||||||
|
@ -517,10 +517,10 @@ class so_sql
|
|||||||
if ($wildcard || $criteria[$col]{0} == '!' ||
|
if ($wildcard || $criteria[$col]{0} == '!' ||
|
||||||
is_string($criteria[$col]) && (strpos($criteria[$col],'*')!==false || strpos($criteria[$col],'?')!==false))
|
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} == '!')
|
if ($criteria[$col]{0} == '!')
|
||||||
{
|
{
|
||||||
$cmp_op = ' NOT LIKE ';
|
$cmp_op = ' NOT'.$cmp_op;
|
||||||
$criteria[$col] = substr($criteria[$col],1);
|
$criteria[$col] = substr($criteria[$col],1);
|
||||||
}
|
}
|
||||||
$query[] = $db_col.$cmp_op.$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$criteria[$col]).$wildcard);
|
$query[] = $db_col.$cmp_op.$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$criteria[$col]).$wildcard);
|
||||||
|
@ -119,15 +119,16 @@
|
|||||||
* @var array $capabilities, defaults will be changed be method set_capabilities($ado_driver,$db_version)
|
* @var array $capabilities, defaults will be changed be method set_capabilities($ado_driver,$db_version)
|
||||||
*/
|
*/
|
||||||
var $capabilities = array(
|
var $capabilities = array(
|
||||||
'sub_queries' => true, // will be set to false for mysql < 4.1
|
'sub_queries' => true, // will be set to false for mysql < 4.1
|
||||||
'union' => true, // will be set to false for mysql < 4.0
|
'union' => true, // will be set to false for mysql < 4.0
|
||||||
'outer_join' => false, // does the DB has an outer join, will be set eg. for postgres
|
'outer_join' => false, // does the DB has an outer join, will be set eg. for postgres
|
||||||
'distinct_on_text' => true, // is the DB able to use DISTINCT with a text or blob column
|
'distinct_on_text' => true, // is the DB able to use DISTINCT with a text or blob column
|
||||||
'like_on_text' => true, // is the DB able to use LIKE with text columns
|
'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)
|
'name_case' => 'upper', // case of returned column- and table-names: upper, lower(pgSql), preserv(MySQL)
|
||||||
'client_encoding' => false, // db uses a changeable clientencoding
|
'client_encoding' => false, // db uses a changeable clientencoding
|
||||||
'order_on_text' => true, // is the DB able to order by a given text column, boolean or
|
'case_insensitive_like' => 'LIKE', // case insensitive version of like, eg. ILIKE for postgres
|
||||||
); // string for sprintf for a cast (eg. 'CAST(%s AS varchar)')
|
'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)')
|
||||||
|
|
||||||
var $prepared_sql = array(); // sql is the index
|
var $prepared_sql = array(); // sql is the index
|
||||||
|
|
||||||
@ -341,6 +342,7 @@
|
|||||||
$this->capabilities['name_case'] = 'lower';
|
$this->capabilities['name_case'] = 'lower';
|
||||||
$this->capabilities['client_encoding'] = (float) $db_version >= 7.4;
|
$this->capabilities['client_encoding'] = (float) $db_version >= 7.4;
|
||||||
$this->capabilities['outer_join'] = true;
|
$this->capabilities['outer_join'] = true;
|
||||||
|
$this->capabilities['case_insensitive_like'] = 'ILIKE';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
|
Loading…
Reference in New Issue
Block a user