Yichun Zhang (章亦春) > OpenResty > OpenResty::SQL::Select

Download:
OpenResty-0.5.12.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

OpenResty::SQL::Select - SQL generator for select statements

INHERITANCE ^

    OpenResty::SQL::Select
        ISA OpenResty::SQL::Statement

SYNOPSIS ^

    use OpenResty::SQL::Select;

    my $select = OpenResty::SQL::Select->new;
    $select->select( qw<name type label> )
        ->from( '_columns' );
    $select->where("table_name", '=', _Q('blah'));
    $select->order_by("foo");
    $select->where("Foo", '>', 'bar')->where('Bar' => '3');
    print "$select";
        # produces:
        #       select name, type, label
        #       from _columns
        #       where table_name = 'blah' and Foo > bar and Bar = 3
        #       order by foo;

DESCRIPTION ^

This class provides an OO interface for generating SQL select statements without the pain of concatenating plain SQL strings.

METHODS ^

new(@columns)
from(@tables)
where($column => $value)
order_by($column)
order_by($column => $direction)
limit($limit)
offset($offset)
generate

AUTHOR ^

Agent Zhang (agentzh) <agentzh@yahoo.cn>

SEE ALSO ^

OpenResty::SQL::Statement, OpenResty::SQL::Insert, OpenResty::SQL::Update, OpenResty.

syntax highlighting: