/** * Check whether a field is unique. * * The check for unique tag names must take into account CASE SENSITIVITY, * which is accomplished via COLLATE utf8_bin sql * * @return bool */ protected function fieldIsUnique($field, $value = null) { if ($field != 'name') { return parent::fieldIsUnique($field, $value); } else { $db = $this->getDb(); $sql = "\n SELECT id \n FROM {$db->Tag} \n WHERE name COLLATE utf8_bin LIKE ?"; $res = $db->query($sql, array($value ? $value : $this->name)); return !is_array($id = $res->fetch()) || ($this->exists() and $id['id'] == $this->id); } }