From baf09cb84df31d557a993d531d82a766e3fbe8b7 Mon Sep 17 00:00:00 2001 From: Jacek Ablewicz Date: Fri, 8 Jul 2016 11:39:02 +0200 Subject: [PATCH] Bug 16076 - DBIx searches - performance issues Experimental method Koha::Objects->search_all_unblessed() added for testing an impact of DBIx::Class::ResultClass::HashRefInflator on search performance. --- Koha/Objects.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index 6c03ff5..e2f2f3e 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -130,6 +130,17 @@ sub search { } } +sub search_all_unblessed { + my ( $self, $params, $attributes ) = @_; + + my $newattr = $attributes? { (%$attributes) }: {}; + $attributes->{result_class} = 'DBIx::Class::ResultClass::HashRefInflator'; + my @results = $self->_resultset()->search($params, $attributes); + @results == 1 && !($results[0]) && return; + + \@results; +} + =head3 Koha::Objects->count(); my @objects = Koha::Objects->count($params); -- 1.7.10.4