IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32063


Ignore:
Timestamp:
Aug 9, 2011, 4:06:16 PM (15 years ago)
Author:
rhenders
Message:

new method to get a count of registered exposures for the provided date and label

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/czartool/Gpc1Db.pm

    r31873 r32063  
    168168###########################################################################
    169169#
     170# Returns count of exposures that have been registered
     171#
     172# NB JOINing summitExp to newExp to rawExp because summit_id is indexed, whereas
     173# a direct JOIN from summitExp to rawExp using exp_name is more direct, but slower
     174# as exp_name is not indexed in rawExp
     175#
     176###########################################################################
     177sub countRegisteredExposures {
     178    my ($self, $label, $date) = @_;
     179
     180    my $query = $self->{_db}->prepare(<<SQL);
     181    SELECT COUNT(*)
     182        FROM summitExp
     183        JOIN newExp USING (summit_id)
     184        JOIN rawExp USING(exp_id)
     185        JOIN chipRun USING(exp_id)
     186        WHERE summitExp.dateobs > '$date'
     187        AND summitExp.exp_type = 'OBJECT'
     188        AND chipRun.label = "$label";
     189SQL
     190
     191    $query->execute;
     192    return scalar $query->fetchrow_array();
     193}
     194
     195###########################################################################
     196#
    170197# Returns count of exposures with this state for this label
    171198#
Note: See TracChangeset for help on using the changeset viewer.