replace ILIKE with the better-supported LOWER
This commit is contained in:
parent
d7a2ca9ddc
commit
090ff65109
3 changed files with 4 additions and 8 deletions
|
@ -6,7 +6,6 @@ abstract class SCORE
|
|||
const BOOL_Y = "SCORE_BOOL_Y";
|
||||
const BOOL_N = "SCORE_BOOL_N";
|
||||
const BOOL = "SCORE_BOOL";
|
||||
const ILIKE = "SCORE_ILIKE";
|
||||
}
|
||||
|
||||
abstract class DBEngine
|
||||
|
@ -54,7 +53,6 @@ class MySQL extends DBEngine
|
|||
$data = str_replace(SCORE::BOOL_Y, "'$this->BOOL_Y'", $data);
|
||||
$data = str_replace(SCORE::BOOL_N, "'$this->BOOL_N'", $data);
|
||||
$data = str_replace(SCORE::BOOL, "ENUM('Y', 'N')", $data);
|
||||
$data = str_replace(SCORE::ILIKE, "LIKE", $data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -99,7 +97,6 @@ class PostgreSQL extends DBEngine
|
|||
$data = str_replace(SCORE::BOOL_Y, $this->BOOL_Y, $data);
|
||||
$data = str_replace(SCORE::BOOL_N, $this->BOOL_N, $data);
|
||||
$data = str_replace(SCORE::BOOL, "BOOL", $data);
|
||||
$data = str_replace(SCORE::ILIKE, "ILIKE", $data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -193,7 +190,6 @@ class SQLite extends DBEngine
|
|||
$data = str_replace(SCORE::BOOL_Y, "'$this->BOOL_Y'", $data);
|
||||
$data = str_replace(SCORE::BOOL_N, "'$this->BOOL_N'", $data);
|
||||
$data = str_replace(SCORE::BOOL, "CHAR(1)", $data);
|
||||
$data = str_replace(SCORE::ILIKE, "LIKE", $data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,11 +139,11 @@ class NotATag extends Extension
|
|||
$where = ["(1=1)"];
|
||||
$args = ["limit"=>$size, "offset"=>($page-1)*$size];
|
||||
if (!empty($_GET['tag'])) {
|
||||
$where[] = 'tag SCORE_ILIKE :tag';
|
||||
$where[] = 'LOWER(tag) LIKE LOWER(:tag)';
|
||||
$args["tag"] = "%".$_GET['tag']."%";
|
||||
}
|
||||
if (!empty($_GET['redirect'])) {
|
||||
$where[] = 'redirect SCORE_ILIKE :redirect';
|
||||
$where[] = 'LOWER(redirect) LIKE LOWER(:redirect)';
|
||||
$args["redirect"] = "%".$_GET['redirect']."%";
|
||||
}
|
||||
$where = implode(" AND ", $where);
|
||||
|
|
|
@ -283,7 +283,7 @@ class TagList extends Extension
|
|||
FLOOR(LOG(2.7, LOG(2.7, count - :tags_min2 + 1)+1)*1.5*100)/100 AS scaled
|
||||
FROM tags
|
||||
WHERE count >= :tags_min
|
||||
AND tag SCORE_ILIKE :starts_with
|
||||
AND LOWER(tag) LIKE LOWER(:starts_with)
|
||||
ORDER BY LOWER(tag)
|
||||
"), ["tags_min"=>$tags_min, "tags_min2"=>$tags_min, "starts_with"=>$starts_with]);
|
||||
|
||||
|
@ -326,7 +326,7 @@ class TagList extends Extension
|
|||
SELECT tag, count
|
||||
FROM tags
|
||||
WHERE count >= :tags_min
|
||||
AND tag SCORE_ILIKE :starts_with
|
||||
AND LOWER(tag) LIKE LOWER(:starts_with)
|
||||
ORDER BY LOWER(tag)
|
||||
"), ["tags_min"=>$tags_min, "starts_with"=>$starts_with]);
|
||||
|
||||
|
|
Reference in a new issue