From: Davide Franco Date: Mon, 27 Jun 2011 19:59:27 +0000 (+0200) Subject: bacula-web: Fixed bug in sql query when number of volume in pool is zero X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d221775f05c7bbbc9bd907e86d3e5a3058fd0d71;p=bacula%2Fbacula bacula-web: Fixed bug in sql query when number of volume in pool is zero --- diff --git a/gui/bacula-web/includes/bweb.inc.php b/gui/bacula-web/includes/bweb.inc.php index fedbc189b7..8a144df239 100644 --- a/gui/bacula-web/includes/bweb.inc.php +++ b/gui/bacula-web/includes/bweb.inc.php @@ -449,13 +449,13 @@ class Bweb extends DB case 'mysql': $query = 'SELECT COUNT(*) as vols,Pool.name as pool_name '; $query .= 'FROM Media '; - $query .= 'LEFT JOIN Pool ON (Media.PoolId = Pool.PoolId) '; + $query .= 'RIGHT JOIN Pool ON (Media.PoolId = Pool.PoolId) '; $query .= 'WHERE Media.poolid = ' . $pool_id; break; case 'pgsql': $query = 'SELECT COUNT(*) as vols,Pool.name as pool_name '; $query .= 'FROM Media '; - $query .= 'LEFT OUTER JOIN Pool ON (Media.PoolId = Pool.PoolId) '; + $query .= 'RIGHT JOIN Pool ON (Media.PoolId = Pool.PoolId) '; $query .= 'WHERE Media.poolid = ' . $pool_id; $query .= 'GROUP BY pool.name'; break; @@ -464,8 +464,8 @@ class Bweb extends DB $res = $this->db_link->query( $query ); if( PEAR::isError( $res ) ) $this->triggerDBError( 'Unable to get volume number from pool', $res ); - else - $vols = $res->fetchRow( ); + + $vols = $res->fetchRow( ); return array( $vols['pool_name'], $vols['vols'] ); }