X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_ASA_SearchUpdate;h=ba499f97323020baee06b6da7e74cefbe51d8ac5;hp=e39ffec9c7c28c1ff91e36297e7ece8a35bab45e;hb=c615e1bfc6f2b0604a2658996f5dd6b6cfa9469c;hpb=ffbf3b45b24613d268bbb64a901131612b86b4d6 diff --git a/bin/BackupPC_ASA_SearchUpdate b/bin/BackupPC_ASA_SearchUpdate index e39ffec..ba499f9 100755 --- a/bin/BackupPC_ASA_SearchUpdate +++ b/bin/BackupPC_ASA_SearchUpdate @@ -312,14 +312,15 @@ my $host_nr = 0; foreach my $host_key (@hosts) { my $hostname = $hosts->{$host_key}->{'host'} || die "can't find host for $host_key"; + $hostname = lc $hostname; - next if $opt->host && ! grep { m/^$hostname$/ } @{ $opt->host }; + next if $opt->host && ! grep { m/^$hostname$/i } @{ $opt->host }; $sth->{hosts_by_name}->execute($hostname); unless (($hostID) = $sth->{hosts_by_name}->fetchrow_array()) { $sth->{insert_hosts}->execute( - $hosts->{$host_key}->{'host'}, + $hostname, $hosts->{$host_key}->{'ip'} ); @@ -710,8 +711,8 @@ create table archive_burned ( --from backups --join shares on backups.shareid=shares.id --join hosts on shares.hostid = hosts.id ---left outer join archive_backup on backups.id = archive_backup.backup_id ---left outer join archive on archive_backup.archive_id = archive.id +--left outer join archive_backup_parts on backups.id = archive_backup_parts.backup_id +--left outer join archive on archive_backup_parts.archive_id = archive.id --where backups.parts > 0 and size > 0 --order by backups.date --; @@ -722,6 +723,8 @@ CREATE VIEW archive_backup_parts AS SELECT backup_parts.backup_id, archive_id, + dvd_nr, + backup_part_id, hosts.name as host, shares.name as share, backups.num as num, @@ -738,10 +741,22 @@ JOIN archive ON archive_id = archive.id JOIN backups ON backup_id = backups.id JOIN hosts ON hostid = hosts.id JOIN shares ON shareid = shares.id -ORDER BY backup_id, part_nr ; +CREATE VIEW backups_burned AS +SELECT backup_parts.backup_id, +count(backup_parts.backup_id) as backup_parts, +count(archive_burned.archive_id) AS burned_parts, +count(backup_parts.backup_id) = count(archive_burned.archive_id) as burned + FROM backup_parts + left outer JOIN archive_parts ON backup_part_id = backup_parts.id + left join archive on archive.id = archive_id + left outer join archive_burned on archive_burned.archive_id = archive.id + GROUP BY backup_parts.backup_id ; + + +-- triggers for backup_parts consistency create or replace function backup_parts_check() returns trigger as ' declare b_parts integer;