Commit 34fd109a authored by Leo Gordon's avatar Leo Gordon
Browse files

API extension: store() now also returns how many actual store operations (as...

API extension: store() now also returns how many actual store operations (as opposed to fetching of already stored ones) it has performed
parent 985c7c1e
......@@ -302,6 +302,8 @@ sub store {
my %hashed_sth = (); # do not prepare statements until there is a real need
my $stored_this_time = 0;
foreach my $object (@$objects) {
if($check_presence_in_db_first and my $present = $self->check_object_present_in_db($object)) {
$self->mark_stored($object, $present);
......@@ -327,6 +329,7 @@ sub store {
or die "Could not store fields\n\t{$column_key}\nwith data:\n\t(".join(',', @$values_being_stored).')';
if($return_code > 0) { # <--- for the same reason we have to be explicitly numeric here
$self->mark_stored($object, $self->dbc->db_handle->last_insert_id(undef, undef, $table_name, $autoinc_id) );
++$stored_this_time;
}
}
}
......@@ -335,7 +338,7 @@ sub store {
$sth->finish();
}
return $object_or_list;
return ($object_or_list, $stored_this_time);
}
......
......@@ -352,7 +352,7 @@ sub run {
die "Every resource has to have a unique description, please fix the PipeConfig file";
}
my $rc = $resource_class_adaptor->create_new(
my ($rc) = $resource_class_adaptor->create_new(
defined($rc_id) ? (-DBID => $rc_id) : (),
-NAME => $rc_name,
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment