fixed found_in_db to prevent duplicate file insertion when restarting from
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Fri, 26 Aug 2005 17:18:27 +0000 (17:18 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Fri, 26 Aug 2005 17:18:27 +0000 (17:18 +0000)
non-empty database.

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@74 8392b6e1-25fa-0310-8288-cc32f8e212ea

bin/BackupPC_updatedb

index 6a5479f..ae14d63 100755 (executable)
@@ -330,7 +330,7 @@ sub found_in_db {
        my @data = @_;
        shift @data;
 
-       my ($key, $shareID,undef,$name,$path,undef,$date,undef,$size) = @_;
+       my ($key, $shareID,undef,$name,$path,$date,undef,$size) = @_;
 
        return $beenThere->{$key} if (defined($beenThere->{$key}));
 
@@ -340,12 +340,13 @@ sub found_in_db {
                        path = ? and 
                        date = ? and
                        size = ?
+               LIMIT 1
        });
 
        my @param = ($shareID,$path,$date,$size);
        $sth->{file_in_db}->execute(@param);
        my $rows = $sth->{file_in_db}->rows;
-       print STDERR "## found_in_db ",( $rows ? '+' : '-' ), join(" ",@param), "\n" if ($debug >= 3);
+       print STDERR "## found_in_db($shareID,$path,$date,$size) ",( $rows ? '+' : '-' ), join(" ",@param), "\n" if ($debug >= 3);
 
        $beenThere->{$key}++;