IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29078


Ignore:
Timestamp:
Aug 30, 2010, 9:06:56 AM (16 years ago)
Author:
rhenders
Message:

New veriosn (12) including a new table for nightlyscience status and a method to update that table

File:
1 edited

Legend:

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

    r29049 r29078  
    119119
    120120    $query->execute;
     121}
     122
     123###########################################################################
     124#
     125# Updates nightlyscience table
     126#
     127###########################################################################
     128sub updateNightlyScience {
     129    my ($self, $status) = @_;
     130
     131    my $query = $self->{_db}->prepare(<<SQL);
     132    DELETE FROM nightlyscience;
     133SQL
     134
     135    $query->execute;
     136
     137    $query = $self->{_db}->prepare(<<SQL);
     138    INSERT INTO nightlyscience
     139        (status)
     140        VALUES
     141        ('$status');
     142SQL
     143
     144       $query->execute;
    121145}
    122146
     
    630654        elsif ($currentRevision == 9) {$self->createRevision_10();}
    631655        elsif ($currentRevision == 10) {$self->createRevision_11();}
     656        elsif ($currentRevision == 11) {$self->createRevision_12();}
    632657        else {last;}
    633658    }
     
    9851010}
    9861011
    987 
     1012#######################################################################################
     1013#
     1014# Create revision 12 of the database
     1015#
     1016#######################################################################################
     1017sub createRevision_12 {
     1018    my ($self) = @_;
     1019
     1020    print "* Creating revision 12 of '$self->{_dbName}'\n";
     1021
     1022    # same shape as other stage tables to enable easy update
     1023    my $query = $self->{_db}->prepare(<<SQL);
     1024    CREATE TABLE nightlyscience (
     1025            timestamp TIMESTAMP DEFAULT NOW(),
     1026            status VARCHAR(128) DEFAULT "NONE");
     1027SQL
     1028
     1029    $query->execute;
     1030
     1031    $self->setRevision(12);
     1032}
    9881033
    98910341;
Note: See TracChangeset for help on using the changeset viewer.