From: Davide Franco Date: Mon, 11 Jul 2011 07:52:21 +0000 (+0200) Subject: bacula-web: Fixed sql query for volumes and pools statistics in bweb class X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d58c12f53dd46d25144d49bf82b0261133a9adf;p=bacula%2Fbacula bacula-web: Fixed sql query for volumes and pools statistics in bweb class --- diff --git a/gui/bacula-web/includes/bweb.inc.php b/gui/bacula-web/includes/bweb.inc.php index 06ffbdbd3e..e9a6f279e7 100644 --- a/gui/bacula-web/includes/bweb.inc.php +++ b/gui/bacula-web/includes/bweb.inc.php @@ -307,7 +307,17 @@ class Bweb extends DB public function getPools() { $pools = array(); - $query = "SELECT name, poolid FROM pool"; + switch( $this->driver ) + { + case 'sqlite': + case 'mysql': + $query = "SELECT name, poolid FROM Pool"; + break; + case 'pgsql': + $query = "SELECT name, poolid FROM pool"; + break; + } + $result = $this->db_link->query ( $query ); if( !PEAR::isError( $result ) ) { @@ -359,16 +369,18 @@ class Bweb extends DB case 'mysql': $query = 'SELECT COUNT(*) as vols_count '; $query .= 'FROM Media '; + if( $pool_id != 'ALL' ) + $query .= ' WHERE Media.poolid = ' . $pool_id; break; case 'pgsql': $query = 'SELECT COUNT(*) as vols_count '; $query .= 'FROM Media '; + if( $pool_id != 'ALL' ) + $query .= ' WHERE media.poolid = ' . $pool_id; break; } - if( $pool_id != 'ALL' ) - $query .= 'WHERE media.poolid = ' . $pool_id; - + // Execute sql query $res = $this->db_link->query( $query ); if( !PEAR::isError( $res ) ) {