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.8 by ahart, Thu Aug 9 06:40:08 2012 UTC vs.
Revision 1.9 by ahart, Fri Aug 24 13:50:50 2012 UTC

# Line 24 | Line 24 | my $argc = @ARGV;
24   printHelp ($ARGV[0]) if $opt{"help"};
25   printHelp () if $argc != 2 && $ARGV[0] ne "createOther";
26   printHelp () if $ARGV[0] ne "create" && $ARGV[0] ne "createOther" && $ARGV[0] ne "update" && $ARGV[0] ne "finish" && $ARGV[0] ne "deprecate" && $ARGV[0] ne "uploadRelease" && $ARGV[0] ne "deleteEntry";
27 if ($ARGV[0] eq "create" && datasetExists ($ARGV[1]))
28  {
29    print "Dataset name already exists in the database!\n";
30    exit;
31  }
27   if (($ARGV[0] eq "create" || $ARGV[0] eq "finish") && !$opt{"location"})
28    {
29      print "The directory containing the ntuples must be given!\n";
# Line 71 | Line 66 | else
66      $status = "deprecated" if $ARGV[0] eq "deprecate";
67      $opt{"format"} = "BEAN" if $ARGV[0] eq "create" && !$opt{"format"};
68      dbUpdate ($id, $fullDataset, $ENV{"USER"}, $opt{"format"}, $opt{"location"}, $opt{"fileList"}, $status, $opt{"comment"}, $opt{"pyConfig"}, $opt{"crabCfg"}, $opt{"jsonFile"}, $opt{"lumiSummary"}, $opt{"release"}) if !$opt{"other"};
69 <    dbUpdateOther ($id, $opt{"comment"}) if $opt{"other"};
69 >    dbUpdateOther ($id, $opt{"comment"}, $ENV{"USER"}) if $opt{"other"};
70      dbDelete ($id) if $ARGV[0] eq "deleteEntry" && !$opt{"other"};
71      dbDeleteOther ($id) if $ARGV[0] eq "deleteEntry" && $opt{"other"};
72    }
# Line 281 | Line 276 | dbUpdate
276        my $id = 1;
277        $id = $row[0] + 1 if $results->numrows ();
278  
279 <      $query = "insert into ntuple (id, dataset, creationTime, lastUpdateTime, user, format, location, fileList, nFiles, sizeInGB, status, comment, pset, crabCfg, jsonFile, lumiSummary, version) values ($id, '$dataset', now(), now(), '$user', '$format', '$fullLocation', '$fileList', $nFiles, $size, '$status', '$comment', '$pset', '$crabCfg', '$jsonFile', '$lumiSummary', '$release')";
279 >      $query = "insert into ntuple (id, dataset, creationTime, lastUpdateTime, lastUpdateUser, user, format, location, fileList, nFiles, sizeInGB, status, comment, pset, crabCfg, jsonFile, lumiSummary, version) values ($id, '$dataset', now(), now(), '$user', '$user', '$format', '$fullLocation', '$fileList', $nFiles, $size, '$status', '$comment', '$pset', '$crabCfg', '$jsonFile', '$lumiSummary', '$release')";
280      }
281    if ($id > 0)
282      {
# Line 290 | Line 285 | dbUpdate
285  
286        $values .= ", dataset='$dataset'" if $dataset;
287        $values .= ", lastUpdateTime=now()";
288 +      $values .= ", lastUpdateUser='$user'";
289        $values .= ", format='$format'" if $format;
290        $values .= ", location='$fullLocation'" if $location;
291        $values .= ", fileList='$fileList'" if $fileList;
# Line 316 | Line 312 | dbUpdateOther
312   {
313    my $id = shift;
314    my $comment = shift;
315 +  my $user = shift;
316  
317    $comment = addSlashes ($comment);
318  
319 <  my $query = "update other set lastUpdateTime=now(), comment='$comment'  where id=$id";
319 >  my $query = "update other set lastUpdateTime=now(), lastUpdateUser='$user', comment='$comment'  where id=$id";
320    $db->selectdb ("ntuple");
321    my $results = $db->query ($query);
322  
# Line 537 | Line 534 | uploadRelease
534   }
535  
536   sub
540 datasetExists
541 {
542  my $dataset = shift;
543
544  my $query = "select id from ntuple where dataset='$dataset'";
545  $db->selectdb ("ntuple");
546  my $results = $db->query ($query);
547
548  return $results->numrows ();
549 }
550
551 sub
537   dbOtherCreate
538   {
539    my $user = shift;
# Line 585 | Line 570 | dbOtherCreate
570    $location = addSlashes ($location);
571    $comment = addSlashes ($comment);
572  
573 <  my $query = "insert into other (id, creationTime, lastUpdateTime, user, location, nFiles, sizeInGB, comment) values ($id, now(), now(), '$user', '$location', $nFiles, $size, '$comment')";
573 >  my $query = "insert into other (id, creationTime, lastUpdateTime, lastUpdateUser, user, location, nFiles, sizeInGB, comment) values ($id, now(), now(), '$user', '$user', '$location', $nFiles, $size, '$comment')";
574    $db->selectdb ("ntuple");
575    my $results = $db->query ($query);
576  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines