| 1 | package Teng::Plugin::SearchBySQLAbstractMore::Pager::CountOrMySQLFoundRows; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Teng::Iterator; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Data::Page; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Teng::Plugin::SearchBySQLAbstractMore (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Teng::Plugin::SearchBySQLAbstractMore::Pager::Count (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Teng::Plugin::SearchBySQLAbstractMore::Pager::MySQLFoundRows (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | our @EXPORT = qw/search_by_sql_abstract_more_with_pager/; | |||||||||
| 14 | |||||||||||
| 15 | sub init { | ||||||||||
| 16 | 0 | ▶ | $_[1]->Teng::Plugin::SearchBySQLAbstractMore::_init(); | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | # work around | ||||||||||
| 20 | 1 | push @EXPORT, qw/sql_abstract_more_instance/; | |||||||||
| 21 | 1 | *sql_abstract_more_instance = \&Teng::Plugin::SearchBySQLAbstractMore::sql_abstract_more_instance; | |||||||||
| 22 | |||||||||||
| 23 | sub search_by_sql_abstract_more_with_pager { | ||||||||||
| 24 | 0 | ▶ | my ($self, $table_name, $where, $_opt) = @_; | ||||||||
|
Subroutine
search_by_sql_abstract_more_with_pager: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 25 | |||||||||||
| 26 | 0 | my $sql_abstract_more = $self->sql_abstract_more_instance; | |||||||||
| 27 | |||||||||||
| 28 | 0 | ($table_name, my($args, $rows, $page)) = Teng::Plugin::SearchBySQLAbstractMore::_arrange_args($table_name, $where, $_opt); | |||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | $args->{-page} = $args->{-offset} ? $args->{-offset} / $args->{-limit} + 1 : 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | $args->{-rows} = $args->{-limit}; | |||||||||
| 32 | 0 | ▶ | if ($args->{-group_by}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | return $self->Teng::Plugin::SearchBySQLAbstractMore::Pager::MySQLFoundRows::search_by_sql_abstract_more_with_pager($args); | |||||||||
| 34 | } else { | ||||||||||
| 35 | 0 | return $self->Teng::Plugin::SearchBySQLAbstractMore::Pager::Count::search_by_sql_abstract_more_with_pager($args); | |||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | =pod | ||||||||||
| 40 | |||||||||||
| 41 | =head1 NAME | ||||||||||
| 42 | |||||||||||
| 43 | Teng::Plugin::SearchBySQLAbstractMore::Pager::CountOrMySQLFoundRows - pager plugin using SQL::AbstractMore. count total entry by count(*) or CALC FOUND_ROWS of mysql | ||||||||||
| 44 | |||||||||||
| 45 | =head1 DESCRIPTION | ||||||||||
| 46 | |||||||||||
| 47 | If group by is used, use Pager::MySQLFoundRows. | ||||||||||
| 48 | If group by is not used, use Pager::Count; | ||||||||||
| 49 | |||||||||||
| 50 | =head1 SYNOPSIS | ||||||||||
| 51 | |||||||||||
| 52 | see Teng::Plugin::SearchBySQLAbstractMore | ||||||||||
| 53 | |||||||||||
| 54 | =head1 METHODS | ||||||||||
| 55 | |||||||||||
| 56 | =head2 search_by_sql_abstract_more_with_pager | ||||||||||
| 57 | |||||||||||
| 58 | C<search_by_sql_abstract_more> with paging feature. | ||||||||||
| 59 | additional parameter can be taken, C<page> and C<rows>. | ||||||||||
| 60 | |||||||||||
| 61 | =head1 AUTHOR | ||||||||||
| 62 | |||||||||||
| 63 | Ktat, C<< <ktat at cpan.org> >> | ||||||||||
| 64 | |||||||||||
| 65 | =head1 BUGS | ||||||||||
| 66 | |||||||||||
| 67 | Please report any bugs or feature requests to C<bug-teng-plugin-searchbysqlabstractmore at rt.cpan.org>, or through | ||||||||||
| 68 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Teng-Plugin-SearchBySQLAbstractMore>. I will be notified, and then you'll | ||||||||||
| 69 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 70 | |||||||||||
| 71 | =head1 SUPPORT | ||||||||||
| 72 | |||||||||||
| 73 | You can find documentation for this module with the perldoc command. | ||||||||||
| 74 | |||||||||||
| 75 | perldoc Teng::Plugin::SearchBySQLAbstractMore | ||||||||||
| 76 | |||||||||||
| 77 | You can also look for information at: | ||||||||||
| 78 | |||||||||||
| 79 | =over 4 | ||||||||||
| 80 | |||||||||||
| 81 | =item * RT: CPAN's request tracker | ||||||||||
| 82 | |||||||||||
| 83 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Teng-Plugin-SearchBySQLAbstractMore> | ||||||||||
| 84 | |||||||||||
| 85 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 86 | |||||||||||
| 87 | L<http://annocpan.org/dist/Teng-Plugin-SearchBySQLAbstractMore> | ||||||||||
| 88 | |||||||||||
| 89 | =item * CPAN Ratings | ||||||||||
| 90 | |||||||||||
| 91 | L<http://cpanratings.perl.org/d/Teng-Plugin-SearchBySQLAbstractMore> | ||||||||||
| 92 | |||||||||||
| 93 | =item * Search CPAN | ||||||||||
| 94 | |||||||||||
| 95 | L<http://search.cpan.org/dist/Teng-Plugin-SearchBySQLAbstractMore/> | ||||||||||
| 96 | |||||||||||
| 97 | =back | ||||||||||
| 98 | |||||||||||
| 99 | |||||||||||
| 100 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 101 | |||||||||||
| 102 | |||||||||||
| 103 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 104 | |||||||||||
| 105 | Copyright 2012 Ktat. | ||||||||||
| 106 | |||||||||||
| 107 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 108 | under the terms of either: the GNU General Public License as published | ||||||||||
| 109 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 110 | |||||||||||
| 111 | See http://dev.perl.org/licenses/ for more information. | ||||||||||
| 112 | |||||||||||
| 113 | |||||||||||
| 114 | =cut | ||||||||||
| 115 | |||||||||||
| 116 | 1 | 1; # End of Teng::Plugin::SearchBySQLAbstractMore::Pager::Count | |||||||||