SQL::Abstract::Query::Update - An object that represents a SQL UPDATE.
use SQL::Abstract::Query; my $query = SQL::Abstract::Query->new( $dbh ); # Disable all existing customers: my ($sql, @bind_values) = $query->update( 'customer', { active => 0 } ); $dbh->do( $sql, undef, @bind_values ); # Disable all customers in a particular store: my ($sql, @bind_values) = $query->update( 'customer', { active => 0 }, { store_id => $store_id }, ); $dbh->do( $sql, undef, @bind_values ); # Use the OO interface to re-use the query and disabled all customers # in several stores: my $update = $query->update( 'customer', {active=>0}, {store_id=>'id'} ); my $sth = $dbh->prepare( $update->sql() ); $sth->execute( $update->values({ id => $store1_id }); $sth->execute( $update->values({ id => $store2_id });
The update query is a very lightweight wrapper around SQL::Abstract's update() method and provides no additional SQL syntax.
Instances of this class should be created using "update" in SQL::Abstract::Query.
This class applies the SQL::Abstract::Query::Statement role.
See "Table" in SQL::Abstract::Query::Statement.
See "FieldValues" in SQL::Abstract::Query::Statement.
Optional. See "Where" in SQL::Abstract::Query::Statement.
Aran Clary Deltac <bluefeet@gmail.com>
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install SQL::Abstract::Query, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::Abstract::Query
CPAN shell
perl -MCPAN -e shell install SQL::Abstract::Query
For more information on module installation, please visit the detailed CPAN module installation guide.