Changed LOWER(?) to ? COLLATE NOCASE

This commit is contained in:
Marcin Kurczewski 2014-02-19 20:57:33 +01:00
parent dd498cf18d
commit 705e3dfba1
3 changed files with 12 additions and 7 deletions

View file

@ -41,9 +41,10 @@ class TagSearchService extends AbstractSearchService
$token = '%' . $token;
$token .= '%';
$sqlQuery
->and('LOWER(tag.name)')
->like('LOWER(?)')
->put($token);
->and('tag.name')
->like('?')
->put($token)
->collate()->nocase();
}
}
}

View file

@ -119,7 +119,8 @@ class TagModel extends AbstractCrudModel
$query = (new SqlQuery)
->select('*')
->from('tag')
->where('LOWER(name) = LOWER(?)')->put($key);
->where('name = ?')->put($key)
->collate()->nocase();
$row = Database::fetchOne($query);
if ($row)

View file

@ -89,7 +89,8 @@ class UserModel extends AbstractCrudModel
$query = (new SqlQuery)
->select('*')
->from('user')
->where('LOWER(name) = LOWER(?)')->put(trim($key));
->where('name = ?')->put(trim($key))
->collate()->nocase();
$row = Database::fetchOne($query);
if ($row)
@ -105,8 +106,10 @@ class UserModel extends AbstractCrudModel
$query = new SqlQuery();
$query->select('*')
->from('user')
->where('LOWER(name) = LOWER(?)')->put(trim($key))
->or('LOWER(email_confirmed) = LOWER(?)')->put(trim($key));
->where('name = ?')->put(trim($key))
->collate()->nocase()
->or('email_confirmed = ?')->put(trim($key))
->collate()->nocase();
$row = Database::fetchOne($query);
if ($row)