View | Details | Raw Unified | Return to bug 8089
Collapse All | Expand All

(-)a/C4/SQLHelper.pm (-7 / +6 lines)
Lines 234-255 Get the Primary Key field names of the table Link Here
234
234
235
sub GetPrimaryKeys($) {
235
sub GetPrimaryKeys($) {
236
	my $tablename=shift;
236
	my $tablename=shift;
237
    my $result;
237
    my @result;
238
    my $cache;
238
    my $cache;
239
    if (Koha::Cache->is_cache_active()) {
239
    if (Koha::Cache->is_cache_active()) {
240
        $cache = Koha::Cache->new();
240
        $cache = Koha::Cache->new();
241
        if (defined $cache) {
241
        if (defined $cache) {
242
            $result = $cache->get_from_cache("sqlhelper:GetPrimaryKeys:$tablename");
242
            @result = $cache->get_from_cache("sqlhelper:GetPrimaryKeys:$tablename");
243
        }
243
        }
244
    }
244
    }
245
    unless (defined $result) {
245
    unless (@result) {
246
        my $hash_columns=_get_columns($tablename);
246
        my $hash_columns=_get_columns($tablename);
247
        $result = grep { $hash_columns->{$_}->{'Key'} =~/PRI/i}  keys %$hash_columns;
247
        @result = grep { $hash_columns->{$_}->{'Key'} =~/PRI/i}  keys %$hash_columns;
248
        if (Koha::Cache->is_cache_active() && defined $cache) {
248
        if (Koha::Cache->is_cache_active() && defined $cache) {
249
            $cache->set_in_cache("sqlhelper:GetPrimaryKeys:$tablename", $result);
249
            $cache->set_in_cache("sqlhelper:GetPrimaryKeys:$tablename", @result);
250
        }
250
        }
251
    }
251
    }
252
    return $result;
252
    return @result;
253
}
253
}
254
254
255
255
256
- 

Return to bug 8089