Changeset 386 for trunk


Ignore:
Timestamp:
09/17/12 17:52:13 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix the fix for the slow group listing; it only worked when "Search
subgroups" was selected, instead of returning counts for the subgroups
of the current group.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r385 r386  
    24832483##fixme:  put this whole sub in a transaction?  might be
    24842484# needed for accurate results on very busy systems.
    2485   my %gref;
    2486   my $i = 0;
     2485##fixme:  large group lists need prepared statements?
     2486#my $ucsth = $dbh->prepare("SELECT count(*) FROM users WHERE group_id=?");
     2487#my $dcsth = $dbh->prepare("SELECT count(*) FROM domains WHERE group_id=?");
     2488#my $rcsth = $dbh->prepare("SELECT count(*) FROM revzones WHERE group_id=?");
    24872489  foreach (@{$glist}) {
    2488     $gref{$$_{groupid}} = $i++;
    2489   }
    2490   my $tmpchlist = $args{curgroup}.($args{childlist} ? ",$args{childlist}" : '');
    2491   foreach my $grp (split /,/, $tmpchlist) {
    2492     my ($ucnt) = $dbh->selectrow_array("SELECT count(*) FROM users WHERE group_id=?", undef, ($grp));
    2493     $glist->[$gref{$grp}]{nusers} = $ucnt;
    2494     my ($dcnt) = $dbh->selectrow_array("SELECT count(*) FROM domains WHERE group_id=?", undef, ($grp));
    2495     $glist->[$gref{$grp}]{ndomains} = $dcnt;
    2496     my ($rcnt) = $dbh->selectrow_array("SELECT count(*) FROM revzones WHERE group_id=?", undef, ($grp));
    2497     $glist->[$gref{$grp}]{nrevzones} = $rcnt;
     2490    my ($ucnt) = $dbh->selectrow_array("SELECT count(*) FROM users WHERE group_id=?", undef, ($$_{groupid}));
     2491    $$_{nusers} = $ucnt;
     2492    my ($dcnt) = $dbh->selectrow_array("SELECT count(*) FROM domains WHERE group_id=?", undef, ($$_{groupid}));
     2493    $$_{ndomains} = $dcnt;
     2494    my ($rcnt) = $dbh->selectrow_array("SELECT count(*) FROM revzones WHERE group_id=?", undef, ($$_{groupid}));
     2495    $$_{nrevzones} = $rcnt;
    24982496  }
    24992497
Note: See TracChangeset for help on using the changeset viewer.