« blib/lib/App/Netdisco/DB/ResultSet/DevicePortLog.pm
↑ Summary
blib/lib/App/Netdisco/DB/ResultSet/DevicePower.pm »
| 1 | package App::Netdisco::DB::ResultSet::DevicePortSsid; | ||
| 2 | use base 'App::Netdisco::DB::ResultSet'; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | __PACKAGE__->load_components( | ||
| 8 | qw/ | ||
| 9 | +App::Netdisco::DB::ExplicitLocking | ||
| 10 | / | ||
| 11 | ); | ||
| 12 | |||
| 13 | =head1 ADDITIONAL METHODS | ||
| 14 | |||
| 15 | =head2 get_ssids | ||
| 16 | |||
| 17 | Returns a sorted list of SSIDs with the following columns only: | ||
| 18 | |||
| 19 | =over 4 | ||
| 20 | |||
| 21 | =item ssid | ||
| 22 | |||
| 23 | =item broadcast | ||
| 24 | |||
| 25 | =item count | ||
| 26 | |||
| 27 | =back | ||
| 28 | |||
| 29 | Where C<count> is the number of instances of the SSID in the Netdisco | ||
| 30 | database. | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | sub get_ssids { | ||
| 35 | my $rs = shift; | ||
| 36 | |||
| 37 | return $rs->search( | ||
| 38 | {}, | ||
| 39 | { select => [ 'ssid', 'broadcast', { count => 'ssid' } ], | ||
| 40 | as => [qw/ ssid broadcast count /], | ||
| 41 | group_by => [qw/ ssid broadcast /], | ||
| 42 | order_by => { -desc => [qw/count/] }, | ||
| 43 | } | ||
| 44 | ) | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | 1; |