| OpenResty documentation | view source | Contained in the OpenResty distribution. |
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)generateAgent Zhang (agentzh) <agentzh@yahoo.cn>
| OpenResty documentation | view source | Contained in the OpenResty distribution. |