NAME

OpenResty::SQL::Update - SQL generator for update statements

INHERITANCE

OpenResty::SQL::Update
    ISA OpenResty::SQL::Statement

SYNOPSIS

use OpenResty::SQL::Update;
my $update = OpenResty::SQL::Update->new;
$update->update( 'models' )
    ->set( 'abc' => '"howdy"' );
print $update->generate;
    # produces:
    #      update models set abc = "howdy";

$update->where("table_name", '=', _Q('blah'))->set(foo => 'bar');
print "$update";
    # produces:
    #       update models
    #       set abc = "howdy", foo = bar
    #       where table_name = 'blah';

$update->where("Foo", '>', 'bar');
print "$update";
    # produces:
    #        update models
    #        set abc = "howdy", foo = bar
    #        where table_name = 'blah' and Foo > bar;

$update->reset( qw<abc> )
    ->set( 'foo' => 3 )->where(name => '"John"');
print "$update";
    # produces:
    #       update abc
    #       set foo = 3
    #       where name = "John";

DESCRIPTION

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

METHODS

new($table) =item new()
update($table)
where($column = $value)>
reset() =item reset($table)
generate

AUTHOR

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

SEE ALSO

OpenResty::SQL::Statement, OpenResty::SQL::Insert, OpenResty::SQL::Select, OpenResty.