]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: Fixed sql query for volumes and pools statistics in bweb class
authorDavide Franco <bacula-dev@dflc.ch>
Mon, 11 Jul 2011 07:52:21 +0000 (09:52 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:22 +0000 (14:49 +0200)
gui/bacula-web/includes/bweb.inc.php

index 06ffbdbd3ea6350be9a51a5ae15382b1ce7aa298..e9a6f279e750f579b6f37e11b62b5ac8748f5fde 100644 (file)
@@ -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 ) ) {