Changeset 28896
- Timestamp:
- Aug 11, 2010, 12:11:13 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/perl/ippToPsps/IppToPspsDb.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/perl/ippToPsps/IppToPspsDb.pm
r28871 r28896 8 8 use ippToPsps::MySQLDb; 9 9 our @ISA = qw(ippToPsps::MySQLDb); # inherits from MySQLDb 10 11 12 ########################################################################### 13 # 14 # Returns a list of batches that have been processed and loaded to datastore 15 # 16 ########################################################################### 17 sub getBatchList { 18 my ($self, $exposures) = @_; 19 20 my $query = $self->{_db}->prepare(<<SQL); 21 SELECT exp_id, batch_id, survey_id 22 FROM batches 23 WHERE processed = 1 24 AND on_datastore = 1 25 AND created > '2010-08-10 12:03:40'; 26 SQL 27 28 # TODO remove date restriction 29 $query->execute; 30 ${$exposures} = $query->fetchall_arrayref(); 31 my $count = scalar @{${$exposures}}; 32 33 printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es"); 34 return $count; 35 } 36 37 ########################################################################### 38 # 39 # Returns a info about one particular batch 40 # 41 ########################################################################### 42 sub getSingleBatch{ 43 my ($self, $batch_id, $exposures) = @_; 44 45 my $query = $self->{_db}->prepare(<<SQL); 46 SELECT exp_id, batch_id, survey_id 47 FROM batches 48 WHERE batch_id = $batch_id 49 AND processed = 1 50 AND on_datastore = 1; 51 SQL 52 53 $query->execute; 54 ${$exposures} = $query->fetchall_arrayref(); 55 my $count = scalar @{${$exposures}}; 56 57 printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es"); 58 return $count; 59 } 10 60 11 61 ####################################################################################### … … 137 187 return $batchId; 138 188 } 189 190 ####################################################################################### 191 # 192 # Updates an existing database record with info from ODM 193 # 194 ####################################################################################### 195 sub updateODMStatus { 196 my ($self,$batchId, $expId, $loadedToOdm, $mergeWorthy, $mergeCompleted) = @_; 197 198 my $query = $self->{_db}->prepare(<<SQL); 199 UPDATE batches 200 SET loaded_to_ODM = $loadedToOdm, merge_worthy = $mergeWorthy, merged = $mergeCompleted 201 WHERE batch_id = $batchId 202 AND exp_id = $expId; 203 SQL 204 205 $query->execute; # TODO check response of these 206 } 207 208 139 209 140 210 ###########################################################################
Note:
See TracChangeset
for help on using the changeset viewer.
