/[BackupPC]/trunk/bin/BackupPC_updatedb
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/bin/BackupPC_updatedb

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

revision 14 by dpavlin, Sun Jul 10 22:56:43 2005 UTC revision 25 by dpavlin, Wed Jul 13 09:57:41 2005 UTC
# Line 81  if ($opt{c}) { Line 81  if ($opt{c}) {
81                  create table files (                  create table files (
82                          ID      INTEGER         NOT NULL PRIMARY KEY,                            ID      INTEGER         NOT NULL PRIMARY KEY,  
83                          shareID INTEGER         NOT NULL references shares(id),                          shareID INTEGER         NOT NULL references shares(id),
84                          backupNum  INTEGER      NOT NULL references backups(id),                          backupNum  INTEGER      NOT NULL references backups(num),
85                          name       VARCHAR(255) NOT NULL,                          name       VARCHAR(255) NOT NULL,
86                          path       VARCHAR(255) NOT NULL,                          path       VARCHAR(255) NOT NULL,
87                          fullpath   VARCHAR(255) NOT NULL,                          fullpath   VARCHAR(255) NOT NULL,
# Line 186  foreach my $host_key (keys %{$hosts}) { Line 186  foreach my $host_key (keys %{$hosts}) {
186                  my $backupNum = $backup->{'num'};                  my $backupNum = $backup->{'num'};
187                  my @backupShares = ();                  my @backupShares = ();
188    
189                  print $hosts->{$host_key}->{'host'},"\t$backupNum\n";                  print $hosts->{$host_key}->{'host'},"\t#$backupNum\n";
190    
191                  $sth->{backups_broj}->execute($hostID, $backupNum);                  $sth->{backups_broj}->execute($hostID, $backupNum);
192                  my ($broj) = $sth->{backups_broj}->fetchrow_array();                  my ($broj) = $sth->{backups_broj}->fetchrow_array();
# Line 236  sub getShareID() { Line 236  sub getShareID() {
236                  VALUES (?,?,?,?)                  VALUES (?,?,?,?)
237          });          });
238    
239          $sth->{insert_share}->execute($hostID,$share, $hostname . $share,undef);          my $drop_down = $hostname . '/' . $share;
240            $drop_down =~ s#//+#/#g;
241    
242            $sth->{insert_share}->execute($hostID,$share, $drop_down ,undef);
243          return $dbh->func('last_insert_rowid');                  return $dbh->func('last_insert_rowid');        
244  }  }
245    
# Line 256  sub found_in_db { Line 259  sub found_in_db {
259          my @param = ($shareID,$path,$name,$date,$size);          my @param = ($shareID,$path,$name,$date,$size);
260          $sth->{file_in_db}->execute(@param);          $sth->{file_in_db}->execute(@param);
261          my ($rows) = $sth->{file_in_db}->fetchrow_array();          my ($rows) = $sth->{file_in_db}->fetchrow_array();
262          print STDERR ( $rows ? '+' : '-' ), join(" ",@param), "\n";  #       print STDERR ( $rows ? '+' : '-' ), join(" ",@param), "\n";
263          return $rows;          return $rows;
264  }  }
265    
# Line 298  sub recurseDir($$$$$$$$) { Line 301  sub recurseDir($$$$$$$$) {
301    
302                  if (! $beenThere->{$key} && ! found_in_db(@data)) {                  if (! $beenThere->{$key} && ! found_in_db(@data)) {
303                          $sth->{'insert_files'}->execute(@data);                          $sth->{'insert_files'}->execute(@data);
304                          print STDERR "$key\n";  #                       print STDERR "$key\n";
305                          if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {                          if ($filesInBackup->{$path_key}->{'type'} == BPC_FTYPE_DIR) {
306                                  $new_dirs++;                                  $new_dirs++;
307                          } else {                          } else {

Legend:
Removed from v.14  
changed lines
  Added in v.25

  ViewVC Help
Powered by ViewVC 1.1.26