IdoQuery: Allow check if a column is case insensitive compared

refs #9029
This commit is contained in:
Johannes Meyer 2015-08-17 15:05:44 +02:00
parent b061161979
commit 84ac316cde
1 changed files with 25 additions and 0 deletions

View File

@ -553,6 +553,31 @@ abstract class IdoQuery extends DbQuery
return stripos($mapped, 'UNIX_TIMESTAMP') !== false;
}
/**
* Return whether the given alias or column name provides case insensitive value comparison
*
* @param string $aliasOrColumn
*
* @return bool
*/
public function isCaseInsensitive($aliasOrColumn)
{
if ($this->isCustomVar($aliasOrColumn)) {
return false;
}
$column = $this->getMappedField($aliasOrColumn) ?: $aliasOrColumn;
if (! $column) {
return false;
}
if (! empty($this->columnsWithoutCollation)) {
return in_array($column, $this->columnsWithoutCollation) || strpos($column, 'LOWER') !== 0;
}
return preg_match('/ COLLATE .+$/', $column) === 1;
}
/**
* Apply oracle specific query initialization
*/