NAME
SQL::Abstract::Query::Update - An object that represents a SQL UPDATE.
SINOPSYS
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 });
DESCRIPTION
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.
ARGUMENTS
table
See "Table" in SQL::Abstract::Query::Statement.
field_values
See "FieldValues" in SQL::Abstract::Query::Statement.
where
Optional. See "Where" in SQL::Abstract::Query::Statement.
AUTHOR
Aran Clary Deltac <bluefeet@gmail.com>
LICENSE
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.