IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29186


Ignore:
Timestamp:
Sep 21, 2010, 4:38:03 PM (16 years ago)
Author:
rhenders
Message:

Changed update functions for clarity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/perl/ippToPsps/IppToPspsDb.pm

    r29092 r29186  
    99our @ISA = qw(ippToPsps::MySQLDb);    # inherits from MySQLDb
    1010
    11 
    1211###########################################################################
    1312#
     
    1918
    2019    my $query = $self->{_db}->prepare(<<SQL);
    21     SELECT created, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged
     20    SELECT created, batch_type, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged
    2221        FROM batches
    2322        WHERE created >= '$fromTime'
    24         AND created <= '$toTime';
     23        AND created <= '$toTime'
    2524SQL
    2625
     
    3029    my $count = scalar @{${$batches}};
    3130
    32    printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es");
    3331   return $count;
    3432}
     
    4341
    4442    my $query = $self->{_db}->prepare(<<SQL);
    45     SELECT created, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged
     43    SELECT created, batch_type, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged
    4644        FROM batches
    4745        WHERE batch_id = $batch_id
     
    5250    my $count = scalar @{${$batches}};
    5351
    54    printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es");
    5552   return $count;
    5653}
     
    103100#
    104101########################################################################################
    105 sub updateBatch {
    106     my ($self, $batchId, $expId, $processed, $published, $totalDetections, $minObjId, $maxObjId) = @_;
     102sub setAsProcessed {
     103    my ($self, $batchId, $expId, $totalDetections, $minObjId, $maxObjId) = @_;
    107104
    108105    if (!$minObjId) {$minObjId = -1;}
     
    114111    UPDATE batches
    115112        SET
    116           processed = $processed,
    117           on_datastore = $published,
     113          processed = 1,
    118114          total_detections = $totalDetections,
    119115          min_obj_id = $minObjId,
     
    128124#######################################################################################
    129125#
     126# Sets published state of a batch
     127#
     128########################################################################################
     129sub setPublished {
     130    my ($self, $batchId, $expId, $published) = @_;
     131
     132    my $query = $self->{_db}->prepare(<<SQL);
     133    UPDATE batches
     134        SET on_datastore = $published
     135        WHERE batch_id = $batchId
     136        AND exp_id = $expId;
     137SQL
     138
     139    $query->execute; # TODO check response of this
     140}
     141
     142#######################################################################################
     143#
    130144# Checks whether we have successfully processed this exposure
    131145#
     
    138152        FROM batches
    139153        WHERE exp_id = $expId
    140         AND created > '2010-08-12'
    141154        AND processed = 1;
    142155SQL
     
    179192    $query->execute;
    180193
    181     print "* New batch '$batchId' for exposure ID = $expId and survey = '$surveyType'\n";
     194    print "* New batch '$batchId' for exposure ID = '$expId' and survey = '$surveyType'\n";
    182195
    183196    return $batchId;
Note: See TracChangeset for help on using the changeset viewer.