View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Atsushi Kobayashi > Teng > Teng::Plugin::SQLPager



Annotate this POD

View/Report Bugs
Source   Latest Release: Teng-0.31


Teng::Plugin::SQLPager - paginate with sql


    package My::DB;
    use parent qw/Teng/;

    # in your application
        q{SELECT * FROM member ORDER BY id DESC},
        {page => 1, rows => 20}


This module searches database by SQL with paginate.

search_by_sql_with_pager method adds LIMIT clause automatically.

ARGUMENTS FOR search_by_sql_with_pager ^

You can pass arguments as following.

    $db->search_by_sql_with_pager($sql, $binds, $opt[, $table_name]);
$sql: Str

This is a SQL statement in string.

$binds: ArrayRef[Str]

This is a bind values in arrayref.

$opt: HashRef

Options for search_by_sql_with_pager. Important options are 'page' and 'rows'.

page is a current page number. rows is a entries per page.

$table_name: Str

You can pass a table name.

This argument is optional. If you don't pass a table name, Teng guess table name automatically.


This module does not work with Oracle since Oracle does not support limit clause.

syntax highlighting: