We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 6830730c authored by Mike Sheldon's avatar Mike Sheldon

Reduce query duplication from previous commit

parent 845303ef
......@@ -49,14 +49,13 @@ class Artist {
global $adodb;
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$mbidquery = "";
if($mbid) {
$row = $adodb->CacheGetRow(1200, 'SELECT name, mbid, streamable, bio_published, bio_content, bio_summary, image_small, image_medium, image_large FROM Artist WHERE '
. 'mbid = ' . $adodb->qstr($mbid) . ' OR '
. 'name = ' . $adodb->qstr($name));
} else {
$row = $adodb->CacheGetRow(1200, 'SELECT name, mbid, streamable, bio_published, bio_content, bio_summary, image_small, image_medium, image_large FROM Artist WHERE '
. 'name = ' . $adodb->qstr($name));
$mbidquery = 'mbid = ' . $adodb->qstr($mbid) . ' OR ';
}
$row = $adodb->CacheGetRow(1200, 'SELECT name, mbid, streamable, bio_published, bio_content, bio_summary, image_small, image_medium, image_large FROM Artist WHERE '
. $mbidquery
. 'name = ' . $adodb->qstr($name));
if(!$row) {
throw new Exception('No such artist' . $name);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment