optimise a very common (99%) case

git-svn-id: file:///home/shish/svn/shimmie2/trunk@210 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-04 00:56:02 +00:00
parent a917073fee
commit a92b2fdcab

View file

@ -151,6 +151,11 @@ class Database {
if($positive_tag_count + $negative_tag_count == 0) {
$query = new Querylet($this->get_images);
}
else if($positive_tag_count == 1 && $negative_tag_count == 0) {
$query = new Querylet(
"{$this->get_images} WHERE images.id IN (SELECT image_id FROM tags WHERE tag = ?) ",
$tag_search->variables);
}
else {
$s_tag_array = array_map("sql_escape", $tag_search->variables);
$s_tag_list = join(', ', $s_tag_array);