summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 212cbe2)
raw | patch | inline | side by side (parent: 212cbe2)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 13:35:05 +0000 (13:35 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 4 Mar 2009 13:35:05 +0000 (13:35 +0000) |
Use DBsqlite->count_dbentries for count functions (fai_release, fai_server, packages_list).
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13495 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13495 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-si/modules/DBsqlite.pm | patch | blob | history | |
trunk/gosa-si/server/events/databases.pm | patch | blob | history |
index ec94f298e64eb2a317b3b0a428982a1d136e1e79..c9ebc440f562bc4d91405895236e40f4125f6e9c 100644 (file)
sub count_dbentries {
my ($self, $table)= @_;
my $error= 0;
- my $answer= -1;
+ my $count= -1;
- my $sql_statement= "SELECT * FROM $table";
+ my $sql_statement= "SELECT count() FROM $table";
my $db_answer= &select_dbentry($self, $sql_statement);
+ if(defined($db_answer) && defined($db_answer->{1}) && defined($db_answer->{1}->{'count()'})) {
+ $count = $db_answer->{1}->{'count()'};
+ }
- my $count = keys(%{$db_answer});
return $count;
}
index 942dbda065d886662a2756f5be18f5f7795c7268..ac934d53bde4e33c9e5280ccb719eedf0b8d10ae 100644 (file)
$db = $main::fai_release_db;
}
-
- # prepare sql statement and execute query
- 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 $count = $db->count_dbentries($table);
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) {