summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3f34d79)
raw | patch | inline | side by side (parent: 3f34d79)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 12:52:36 +0000 (12:52 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 12:52:36 +0000 (12:52 +0000) |
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
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 | patch | blob | history |
index 6870505827e081406b744f3d1cb27a6f5002de92..942dbda065d886662a2756f5be18f5f7795c7268 100644 (file)
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( @_ ); }
$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= "<xml><header>answer</header><source>$target</source><target>$source</target><count>$count</count><session_id>$session_id</session_id></xml>";
my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
if (defined $forward_to_gosa) {