OpenResty::SQL::Update - SQL generator for update statements
OpenResty::SQL::Update ISA OpenResty::SQL::Statement
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";
This class provides an OO interface for generating SQL update statements without the pain of concatenating plain SQL strings.
new($table)
new()
update($table)
where($column => $value)
reset()
reset($table)
generate
Agent Zhang (agentzh) <agentzh@yahoo.cn>
<agentzh@yahoo.cn>
OpenResty::SQL::Statement, OpenResty::SQL::Insert, OpenResty::SQL::Select, OpenResty.
To install OpenResty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenResty
CPAN shell
perl -MCPAN -e shell install OpenResty
For more information on module installation, please visit the detailed CPAN module installation guide.