• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/sqlwhere.php
  • Класс: CAllSQLWhere
  • Вызов: CAllSQLWhere::match
public function match($field, $fieldValue, $wildcard)
{
	global $DB;

	if (!is_array($fieldValue))
	{
		$fieldValue = array($fieldValue);
	}
	$orValues = array();
	$wildcard = ($wildcard? "*" : "");

	foreach ($fieldValue as $value)
	{
		$match = FilterHelper::matchAgainstWildcard($value, $wildcard);
		if ($match <> '')
		{
			$orValues[] = $match;
		}
	}

	if(!empty($orValues))
	{
		$connection = BitrixMainApplication::getConnection();
		$helper = $connection->getSqlHelper();
		$value = $helper->getMatchOrExpression($orValues);

		return $helper->getMatchFunction($field, "'" . $helper->forSql($value) . "'");
	}

	return '';
}