Make queries work with sql_mode = 'ONLY_FULL_GROUP_BY' enabled in mysql

This commit is contained in:
bwdutton
2018-02-25 10:12:11 -08:00
parent 47291f41e2
commit cdc4e97c7e

View File

@@ -766,10 +766,10 @@ class gallery_task_Core {
->select_distinct(
array("parent_slug" => db::expr("CONCAT(`parent_id`, ':', LOWER(`slug`))")))
->select("id")
->select(array("C" => "COUNT(\"*\")"))
->select(array("C" => 'COUNT("*")'))
->from("items")
->having("C", ">", 1)
->group_by("parent_slug")
->having('COUNT("*")', ">", 1)
->group_by("parent_slug", "id")
->execute();
}
@@ -779,10 +779,10 @@ class gallery_task_Core {
->select_distinct(
array("parent_name" => db::expr("CONCAT(`parent_id`, ':', LOWER(`name`))")))
->select("id")
->select(array("C" => "COUNT(\"*\")"))
->select(array("C" => 'COUNT("*")'))
->from("items")
->having("C", ">", 1)
->group_by("parent_name")
->having('COUNT("*")', ">", 1)
->group_by("parent_name", "id")
->execute();
}
@@ -792,11 +792,11 @@ class gallery_task_Core {
->select_distinct(
array("parent_base_name" => db::expr("CONCAT(`parent_id`, ':', LOWER(SUBSTR(`name`, 1, LOCATE('.', `name`) - 1)))")))
->select("id")
->select(array("C" => "COUNT(\"*\")"))
->select(array("C" => 'COUNT("*")'))
->from("items")
->where("type", "<>", "album")
->having("C", ">", 1)
->group_by("parent_base_name")
->having('COUNT("*")', ">", 1)
->group_by("parent_base_name", "id")
->execute();
}
@@ -823,4 +823,4 @@ class gallery_task_Core {
->limit($limit)
->execute();
}
}
}