my ($self, $job_ids_csv, $id_scale, $id_offset) = @_;
$id_scale ||= 1;
$id_offset ||= 0;
my %structures = ();
if( $job_ids_csv ) {
my $sql = "SELECT s.dependent_job_id, a.struct_name, a.key_signature, a.value FROM accu a JOIN semaphore s ON (s.semaphore_id=a.receiving_semaphore_id) WHERE s.dependent_job_id in ($job_ids_csv)";
my $sth = $self->prepare( $sql );
$sth->execute();
ROW: while(my ($receiving_job_id, $struct_name, $key_signature, $stringified_value) = $sth->fetchrow_array() ) {
my $value = destringify($stringified_value);
my $sptr = \$structures{$receiving_job_id * $id_scale + $id_offset}{$struct_name};
while( $key_signature=~/(?:(?:\[(\d*)\])|(?:\{(.*?)\}))/g) {
my ($array_index, $hash_key) = ($1, $2);
if(defined($array_index)) {
unless(length($array_index)) {
$array_index = scalar(@{$$sptr||[]});
}
$sptr = \$$sptr->[$array_index];
} elsif(defined($hash_key)) {
if(length($hash_key)) {
$sptr = \$$sptr->{$hash_key};
} else {
$sptr = \$$sptr->{$value};
$$sptr++;
next ROW;
}
}
}
$$sptr = $value;
}
$sth->finish;
}
return \%structures;
}