arrayfromquery optimizations: move double if from inside loop to outside + use directly mysqli calls to avoid function call overhead for every row retrieved from db

git-svn-id: http://piwigo.org/svn/trunk@27336 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices
2014-02-11 21:47:44 +00:00
parent 78621a3487
commit 2d9887993c
6 changed files with 192 additions and 131 deletions
+3 -9
View File
@@ -70,7 +70,7 @@ SELECT tag_id, COUNT(DISTINCT(it.image_id)) AS counter
).'
GROUP BY tag_id
;';
$tag_counters = simple_hash_from_query($query, 'tag_id', 'counter');
$tag_counters = query2array($query, 'tag_id', 'counter');
if ( empty($tag_counters) )
{
@@ -233,7 +233,7 @@ SELECT id
}
$query .= "\n".(empty($order_by) ? $conf['order_by'] : $order_by);
return array_from_query($query, 'id');
return query2array($query, null, 'id');
}
/**
@@ -320,13 +320,7 @@ SELECT *
WHERE '. implode( '
OR ', $where_clauses);
$result = pwg_query($query);
$tags = array();
while ($row = pwg_db_fetch_assoc($result))
{
$tags[] = $row;
}
return $tags;
return query2array($query);
}
?>