mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
DualIndexHashObject: do not overwrite existing data when adding
This commit is contained in:
parent
848a6c4e3d
commit
8b6b969b97
@ -348,7 +348,16 @@ sub add {
|
|||||||
$data->{_name} = $secondary_index;
|
$data->{_name} = $secondary_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}) {
|
||||||
|
foreach my $key (keys %{$data}) {
|
||||||
|
if (not exists $self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{$key}) {
|
||||||
|
$self->{hash}->{$lc_primary_index}->{$lc_secondary_index}->{$key} = $data->{$key};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$self->{hash}->{$lc_primary_index}->{$lc_secondary_index} = $data;
|
$self->{hash}->{$lc_primary_index}->{$lc_secondary_index} = $data;
|
||||||
|
}
|
||||||
|
|
||||||
$self->save() unless $dont_save;
|
$self->save() unless $dont_save;
|
||||||
|
|
||||||
my $name1 = $self->get_key_name($lc_primary_index);
|
my $name1 = $self->get_key_name($lc_primary_index);
|
||||||
|
Loading…
Reference in New Issue
Block a user