From 6e4e6fe24c6b823b29745305757d4f594e86cd73 Mon Sep 17 00:00:00 2001 From: janw Date: Wed, 4 Mar 2009 12:52:36 +0000 Subject: [PATCH] Changed wrong function name. Use SQL Count()-Function to improve performance. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13493 594d385d-05f5-0310-b6e9-bd551577e9d8 --- trunk/gosa-si/server/events/databases.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/trunk/gosa-si/server/events/databases.pm b/trunk/gosa-si/server/events/databases.pm index 687050582..942dbda06 100644 --- a/trunk/gosa-si/server/events/databases.pm +++ b/trunk/gosa-si/server/events/databases.pm @@ -80,7 +80,7 @@ sub query_db { return @out_msg_l; } -sub count_fai_releas{ return &count_db( @_ ); } +sub count_fai_release{ return &count_db( @_ ); } sub count_fai_server{ return &count_db( @_ ); } sub count_packages_list{ return &count_db( @_ ); } sub count_jobdb{ return &count_db( @_ ); } @@ -103,14 +103,16 @@ sub count_db { $db = $main::fai_server_db; } elsif( $header =~ /count_fai_release/ ) { $table = $main::fai_release_tn; - $db = $main::fai_server_db; + $db = $main::fai_release_db; } # prepare sql statement and execute query - my $res_hash = $db->select_dbentry("SELECT * FROM $table"); - - my $count = keys(%{$res_hash}); + my $res_hash = $db->select_dbentry("SELECT count() FROM $table"); + my $count = 0; + if(defined($res_hash) && defined($res_hash->{1}) && defined($res_hash->{1}->{'count()'})) { + $count = $res_hash->{1}->{'count()'}; + } my $out_xml= "
answer
$target$source$count$session_id
"; my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; if (defined $forward_to_gosa) { -- 2.30.2