sphinx\QueryBuilder buildLikeCondition()

buildLikeCondition() public method

Creates an SQL expressions with the LIKE operator.

public string buildLikeCondition ( $indexes, $operator, $operands, &$params )
$indexes yii\sphinx\IndexSchema[]

List of indexes, which affected by query

$operator string

The operator to use (e.g. LIKE, NOT LIKE, OR LIKE or OR NOT LIKE)

$operands array

An array of two or three operands

  • The first operand is the column name.
  • The second operand is a single value or an array of values that column value should be compared with. If it is an empty array the generated expression will be a false value if operator is LIKE or OR LIKE, and empty if operator is NOT LIKE or OR NOT LIKE.
  • An optional third operand can also be provided to specify how to escape special characters in the value(s). The operand should be an array of mappings from the special characters to their escaped counterparts. If this operand is not provided, a default escape mapping will be used. You may use false or an empty array to indicate the values are already escaped and no escape should be applied. Note that when using an escape mapping (or the third operand is not provided), the values will be automatically enclosed within a pair of percentage characters.
$params array

The binding parameters to be populated

return string

The generated SQL expression

throws yii\base\InvalidParamException

if wrong number of operands have been given.

doc_Yii
2016-10-30 17:12:29
Comments
Leave a Comment

Please login to continue.