BUGFIX: Made search filters db agnostic

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@76371 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-05-07 06:00:41 +00:00
parent 32ed6da54c
commit a74c97f564
2 changed files with 2 additions and 10 deletions

View File

@ -25,11 +25,7 @@ class EndsWithFilter extends SearchFilter {
*/ */
public function apply(SQLQuery $query) { public function apply(SQLQuery $query) {
$query = $this->applyRelation($query); $query = $this->applyRelation($query);
$query->where( $query->where($this->getDbName() . " LIKE '%" . Convert::raw2sql($this->getValue()) . "'");
$this->getDbName(),
"RLIKE",
sprintf("%s$",Convert::raw2sql($this->getValue()))
);
} }
public function isEmpty() { public function isEmpty() {

View File

@ -25,11 +25,7 @@ class StartsWithFilter extends SearchFilter {
*/ */
public function apply(SQLQuery $query) { public function apply(SQLQuery $query) {
$query = $this->applyRelation($query); $query = $this->applyRelation($query);
$query->where(sprintf( $query->where($this->getDbName() . " LIKE '" . Convert::raw2sql($this->getValue()) . "%'");
"LOCATE('%s', %s) = 1",
Convert::raw2sql($this->getValue()),
$this->getDbName()
));
} }
public function isEmpty() { public function isEmpty() {