mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-25 02:34:17 +00:00
Merge pull request #5 from fmbiete/master
Add support in carddav searches: starts-with, ends-with, equals, contains
This commit is contained in:
commit
0823f781f0
@ -109,7 +109,21 @@ function SqlFilterCardDAV( $filter, $components, $property = null, $parameter =
|
||||
break;
|
||||
}
|
||||
$pname = ':text_match_'.$matchnum++;
|
||||
$params[$pname] = '%'.$search.'%';
|
||||
$match_type = $v->GetAttribute("match-type");
|
||||
switch( strtolower($match_type) ) {
|
||||
case 'starts-with':
|
||||
$params[$pname] = $search.'%';
|
||||
break;
|
||||
case 'ends-with':
|
||||
$params[$pname] = '%'.$search;
|
||||
break;
|
||||
case 'equals':
|
||||
$params[$pname] = $search;
|
||||
case 'contains':
|
||||
default:
|
||||
$params[$pname] = '%'.$search.'%';
|
||||
break;
|
||||
}
|
||||
dbg_error_log("cardquery", " text-match: (%s%s %s '%s') ", (isset($negate) && strtolower($negate) == "yes" ? "NOT ": ""),
|
||||
$property, $comparison, $params[$pname] );
|
||||
$sql .= sprintf( "AND (%s%s %s $pname) ", (isset($negate) && strtolower($negate) == "yes" ? "NOT ": ""),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user