/[BackupPC]/trunk/lib/BackupPC/SearchLib.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/BackupPC/SearchLib.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 52 by dpavlin, Sat Aug 20 16:40:11 2005 UTC revision 53 by dpavlin, Sat Aug 20 17:19:48 2005 UTC
# Line 156  sub getFiles($$) { Line 156  sub getFiles($$) {
156  sub getBackupsNotBurned() {  sub getBackupsNotBurned() {
157    
158          my $dbh = DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 1 } );          my $dbh = DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 1 } );
159        my $sql = q{          my $sql = q{
160            SELECT          SELECT
161              hosts.ID         AS hostID,                  hosts.ID                AS hostid,
162              hosts.name       AS host,                  min(hosts.name)         AS host,
163              backups.num      AS backupno,                  backups.num             AS backupno,
164              backups.type     AS type,                  min(backups.type)       AS type,
165              backups.date     AS date                  min(backups.date)       AS date
166            FROM backups, shares, files, hosts          FROM backups, shares, files, hosts
167            WHERE          WHERE
168              backups.num    = files.backupNum  AND                  backups.num     = files.backupNum       AND
169              shares.ID      = files.shareID    AND                            shares.ID       = files.shareID         AND        
170              backups.hostID = shares.hostID    AND                  backups.hostID  = shares.hostID         AND
171              hosts.ID       = backups.hostID   AND                  hosts.ID        = backups.hostID        AND
172              files.dvdid    IS NULL                  files.dvdid     IS NULL
173            GROUP BY          GROUP BY
174              backups.hostID, backups.num                  backups.hostID, backups.num, hosts.id
175        };          };
176        my $st = $dbh -> prepare( $sql );          my $sth = $dbh->prepare( $sql );
177        my @ret = ();          my @ret;
178        $st -> execute();          $sth->execute();
179    
180        while ( my $row = $st -> fetchrow_hashref() )          while ( my $row = $sth->fetchrow_hashref() ) {      
181          {                            push(@ret, {
             push(@ret, {  
182                           'host'     => $row->{'host'},                           'host'     => $row->{'host'},
183                           'hostid'   => $row->{'hostID'},                           'hostid'   => $row->{'hostid'},
184                           'backupno' => $row->{'backupno'},                           'backupno' => $row->{'backupno'},
185                           'type'     => $row->{'type'},                           'type'     => $row->{'type'},
186                           'date'     => $row->{'date'}                           'date'     => $row->{'date'}
187                         }                         }
188              );                  );
189          }          }
190                
191        return @ret;                return @ret;      
192    }  }
193    
194  sub displayBackupsGrid()  sub displayBackupsGrid()
195    {    {

Legend:
Removed from v.52  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26