IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28813


Ignore:
Timestamp:
Jul 30, 2010, 4:00:22 PM (16 years ago)
Author:
rhenders
Message:

Added new revision of Db (adding index to batches table) and fixed some bugs

File:
1 edited

Legend:

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

    r28756 r28813  
    5959    my ($self, $batchId, $expId, $processed, $published, $totalDetections) = @_;
    6060
    61 print "HJHJH '$batchId', '$expId', '$processed', '$published', '$totalDetections'\n";
    62 
    6361if (!$totalDetections) {$totalDetections = -1;}
    6462
     
    118116    $batchId++;
    119117
    120     my $query = $self->{_db}->prepare(<<SQL);
     118    $query = $self->{_db}->prepare(<<SQL);
    121119    INSERT INTO batches
    122120        (batch_id, exp_id, survey_id, batch_type)
     
    142140
    143141    my $currentRevision = -1;
    144     my $latestRevision = 4;
     142    my $latestRevision = 5;
    145143
    146144    while ($currentRevision != $latestRevision) {
     
    153151        elsif ($currentRevision == 2) {$self->createRevision_3();}
    154152        elsif ($currentRevision == 3) {$self->createRevision_4();}
     153        elsif ($currentRevision == 4) {$self->createRevision_5();}
    155154    }
    156155}
     
    164163    my ($self) = @_;
    165164
    166     print "* Creating revision 1 of '$dbname'\n";
     165    print "* Creating revision 1 of '$self->{_dbName}'\n";
    167166
    168167    my $query = $self->{_db}->prepare(<<SQL);
     
    175174        $query->execute;
    176175
    177     my $query = $self->{_db}->prepare(<<SQL);
     176    $query = $self->{_db}->prepare(<<SQL);
    178177    CREATE TABLE batches (
    179178            batch_id BIGINT NOT NULL,
     
    192191        $query->execute;
    193192
    194     setRevision(1);
     193    $self->setRevision(1);
    195194}
    196195
     
    203202    my ($self) = @_;
    204203
    205     print "* Creating revision 2 of '$dbname'\n";
     204    print "* Creating revision 2 of '$self->{_dbName}'\n";
    206205
    207206    my $query = $self->{_db}->prepare(<<SQL);
     
    211210        $query->execute;
    212211
    213     setRevision(2);
     212    $self->setRevision(2);
    214213}
    215214
     
    222221    my ($self) = @_;
    223222
    224     print "* Creating revision 3 of '$dbname'\n";
     223    print "* Creating revision 3 of '$self->{_dbName}'\n";
    225224
    226225    my $query = $self->{_db}->prepare(<<SQL);
     
    230229        $query->execute;
    231230
    232     setRevision(3);
     231    $self->setRevision(3);
    233232}
    234233
     
    241240    my ($self) = @_;
    242241
    243     print "* Creating revision 4 of '$dbname'\n";
     242    print "* Creating revision 4 of '$self->{_dbName}'\n";
    244243
    245244    my $query = $self->{_db}->prepare(<<SQL);
     
    249248        $query->execute;
    250249
    251     setRevision(4);
     250    $self->setRevision(4);
     251}
     252
     253#######################################################################################
     254#
     255# Create revision 5 of the database
     256#
     257#######################################################################################
     258sub createRevision_5 {
     259    my ($self) = @_;
     260
     261    print "* Creating revision 5 of '$self->{_dbName}'\n";
     262
     263    my $query = $self->{_db}->prepare(<<SQL);
     264         CREATE INDEX batchesIndex ON batches (batch_id);
     265SQL
     266    $query->execute;
     267
     268    $self->setRevision(5);
    252269}
    253270
Note: See TracChangeset for help on using the changeset viewer.