WireDatabaseDialect::compareCollation()

Get collation to apply to text comparisons, or blank string if none needed

Returns a collation name to append to a text comparison as COLLATE name, making it behave like MySQL's default case- and accent-insensitive collation. MySQL needs no such collation on individual comparisons, as its columns already have one, so it returns blank.

The $value argument lets a dialect decide based on what is being compared, so that the collation can be limited to values that actually need it.

Available since version 3.0.273.

Example

$collate = $database->dialect()->compareCollation($value);
$query->where("$table.data=?" . ($collate ? " COLLATE $collate" : ''), $value);

Usage

// basic usage
$string = $wireDatabaseDialect->compareCollation();

// usage with all arguments
$string = $wireDatabaseDialect->compareCollation($value = null);

Arguments

NameType(s)Description
$value (optional)string int float null

Value being compared, when known

Return value

string


WireDatabaseDialect methods and properties

API reference based on ProcessWire core version 3.0.275