From: janw Date: Wed, 4 Mar 2009 12:52:36 +0000 (+0000) Subject: Changed wrong function name. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6e4e6fe24c6b823b29745305757d4f594e86cd73;p=gosa.git 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 --- 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) {