GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::SKINNY::SQL (3)

.ds Aq ’

NAME

DBIx::Skinny::SQL - dynamic SQL generator

CONTENTS

SYNOPSIS



    my $sql = DBIx::Skinny::SQL;
    $sql->select([foo, bar, baz]);
    $sql->from([table_name]);
    $sql->as_sql;
        #=> "SELECT foo, bar, baz FROM table_name;"

    $sql->add_where(col => "value");
    $sql->as_sql;
        #=> "SELECT foo, bar, baz FROM table_name WHERE ( col = ? );"

    $sql->add_where(name => { like => "%value" });
    $sql->as_sql;
        #=> "SELECT foo, bar, baz FROM table_name WHERE ( col = ? ) AND ( name LIKE ? );"

    $sql->add_where(bar => \"IS NOT NULL");
    $sql->as_sql;
        #=> "SELECT foo, bar, baz FROM table_name WHERE ( col = ? ) AND ( name LIKE ? ) AND ( bar IS NOT NULL );"

    # execute SQL and return DBIx::Skinny::Iterator object.
    my $iter = $sql->retrieve;

    my $sql2 = DBIx::Skinny::SQL->new;
    $sql2->from([]);
    $sql2->add_join(foo => [
        { table => "bar", type => "inner", condition => "foo.bar_id = bar.id" },
    ]);
    $sql2->select([*]);
    $sql2->as_sql;
        #=> "SELECT * FROM foo INNER JOIN bar ON foo.bar_id = bar.id;"

    $sql2->add_complex_where([[ -or => { foo => "bar" }, { foo => "baz" } ]]);
    $sql2->as_sql;
        #=> "SELECT * FROM foo INNER JOIN bar ON foo.bar_id = bar.id WHERE ( ( foo = ? ) OR ( foo = ? ) )"



DESCRIPTION

SEE ALSO

+<Data::ObjectDriver::SQL>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DBIX::SKINNY::SQL (3) 2010-12-21

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.