public function whereFieldSql($field, $sql, array $params = [])
{
$builder = $this->builder();
$placeholderCount = substr_count($sql, '?');
$paramCount = count($params);
if ($placeholderCount !== $paramCount) {
throw new Exception("Number of supplied parameters (" . $paramCount . ") does not match the number of provided placeholders (" . $placeholderCount . ")");
}
$sql = preg_replace_callback('/\\?/', function ($match) use($builder, $params) {
$param = array_shift($params);
return $builder->createPositionalParameter($param);
}, $sql);
$builder->andWhere($this->escapeIdentifier($field) . ' ' . $sql);
return $this;
}