ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/DBTools/scripts/osudb
(Generate patch)

Comparing UserCode/OSUT3Analysis/DBTools/scripts/osudb (file contents):
Revision 1.17 by ahart, Sat Jan 19 07:16:03 2013 UTC vs.
Revision 1.18 by ahart, Sat Jan 19 07:36:04 2013 UTC

# Line 42 | Line 42 | if ($ARGV[0] eq "uploadConfig" && (!$opt
42      print "The Python config and ntuple release must be given!\n";
43      exit;
44    }
45 if ($opt{"location"} && locationExists ($opt{"location"}))
46  {
47    print "This location is already registered in the database!\n";
48    exit;
49  }
45   if ($ARGV[0] eq "uploadRelease")
46    {
47      my $parentDir = "./$opt{'release'}";
# Line 86 | Line 81 | else
81      $status = "" if $ARGV[0] eq "update";
82      $status = "deprecated" if $ARGV[0] eq "deprecate";
83      $opt{"format"} = "BEAN" if $ARGV[0] eq "create" && !$opt{"format"};
84 +    if ($opt{"location"} && locationExists ($id, $opt{"location"}))
85 +      {
86 +        print "This location is already registered in the database!\n";
87 +        exit;
88 +      }
89      dbUpdate ($id, $fullDataset, "$ENV{'USER'}\@$ENV{'HOSTNAME'}", $opt{"format"}, $opt{"location"}, $opt{"name"}, $opt{"fileList"}, $status, $opt{"comment"}, $opt{"pyConfig"}, $opt{"crabCfg"}, $opt{"jsonFile"}, $opt{"lumiSummary"}, $opt{"release"}) if !$opt{"other"};
90      dbUpdateOther ($id, $opt{"comment"}, "$ENV{'USER'}\@$ENV{'HOSTNAME'}") if $opt{"other"};
91      dbDelete ($id) if $ARGV[0] eq "deleteEntry" && !$opt{"other"};
# Line 746 | Line 746 | uploadConfig
746   sub
747   locationExists
748   {
749 +  my $id = shift;
750    my $location = shift;
751  
752    $location =~ s/^(.*)\/+$/$1/;
753 <  my $query = "select id from ntuple where location like '$location%'";
753 >  my $query = "select id from ntuple where location like '$location%' and id!=$id";
754    $db->selectdb ("ntuple");
755    my $results = $db->query ($query);
756    return 1 if $results->numrows ();
# Line 763 | Line 764 | locationExists
764        $location =~ s/^\/data\/se\/store\/(.*)$/\/store\/$1/;
765      }
766  
767 <  my $query = "select id from ntuple where location like '$location%'";
767 >  my $query = "select id from ntuple where location like '$location%' and id!=$id";
768    $db->selectdb ("ntuple");
769    my $results = $db->query ($query);
770    return 1 if $results->numrows ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines