3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

DualIndexSQLiteObject: add missing get_key_name() subroutine

This commit is contained in:
Pragmatic Software 2020-05-01 09:54:50 -07:00
parent b54360485d
commit 1124f4716a

View File

@ -471,6 +471,32 @@ sub get_all {
return @$data;
}
sub get_key_name {
my ($self, $index1, $index2) = @_;
my $lc_index1 = lc $index1;
return $lc_index1 if not exists $self->{cache}->{$lc_index1};
if (not defined $index2) {
if (exists $self->{cache}->{$lc_index1}->{_name}) {
return $self->{cache}->{$lc_index1}->{_name};
} else {
return $lc_index1;
}
}
my $lc_index2 = lc $index2;
return $lc_index2 if not exists $self->{cache}->{$lc_index1}->{$lc_index2};
if (exists $self->{cache}->{$lc_index1}->{$lc_index2}->{_name}) {
return $self->{cache}->{$lc_index1}->{$lc_index2}->{_name};
} else {
return $lc_index2;
}
}
sub get_data {
my ($self, $index1, $index2, $data_index) = @_;