IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28952


Ignore:
Timestamp:
Aug 18, 2010, 12:15:25 PM (16 years ago)
Author:
rhenders
Message:

Can now specify to and from dates when getting list of batches; new method to set delete status for a batch

File:
1 edited

Legend:

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

    r28896 r28952  
    1616###########################################################################
    1717sub getBatchList {
    18     my ($self, $exposures) = @_;
    19 
    20     my $query = $self->{_db}->prepare(<<SQL);
    21     SELECT exp_id, batch_id, survey_id
     18    my ($self, $exposures, $fromTime, $toTime) = @_;
     19
     20    my $query = $self->{_db}->prepare(<<SQL);
     21    SELECT created, exp_id, batch_id, survey_id, deleted
    2222        FROM batches
    2323        WHERE processed = 1
    2424        AND on_datastore = 1
    25         AND created > '2010-08-10 12:03:40';
    26 SQL
    27    
     25        AND created >= '$fromTime'
     26        AND created <= '$toTime';
     27SQL
     28
    2829    # TODO remove date restriction
    2930    $query->execute;
     
    4445
    4546    my $query = $self->{_db}->prepare(<<SQL);
    46     SELECT exp_id, batch_id, survey_id
     47    SELECT created, exp_id, batch_id, survey_id, deleted
    4748        FROM batches
    4849        WHERE batch_id = $batch_id
     
    140141    SELECT COUNT(*)
    141142        FROM batches
    142         WHERE exp_id = $expId
     143        WHERE exp_id = $expId
     144        AND created > '2010-08-12'
    143145        AND processed = 1;
    144146SQL
     
    186188
    187189    return $batchId;
     190}
     191
     192#######################################################################################
     193#
     194# Updates an existing database record to show datastore status
     195#
     196#######################################################################################
     197sub setBatchAsDeleted {
     198    my ($self,$batchId, $expId) = @_;
     199
     200    my $query = $self->{_db}->prepare(<<SQL);
     201    UPDATE batches
     202        SET deleted = 1
     203        WHERE batch_id = $batchId
     204        AND exp_id = $expId;
     205SQL
     206
     207        $query->execute; # TODO check response of these
    188208}
    189209
Note: See TracChangeset for help on using the changeset viewer.