Aran Clary Deltac > SQL-Abstract-Query-0.03 > SQL::Abstract::Query::Delete

Download:
SQL-Abstract-Query-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

SQL::Abstract::Query::Delete - An object that represents a SQL DELETE.

SINOPSYS ^

    use SQL::Abstract::Query;
    my $query = SQL::Abstract::Query->new( $dbh );
    
    # Delete all records from the rental table:
    my ($sql) = $query->delete( 'rental' );
    $dbh->do( $sql );
    
    # Delete all inventory for a particular film:
    my ($sql, @bind_values) = $query->delete( 'inventory', {film_id => $film_id} );
    $dbh->do( $sql, undef, @bind_values );
    
    # Use the OO interface to re-use the query and delete all staff in
    # several stores:
    my $delete = $query->delete( 'staff', {store_id => 'id'} );
    my $sth = $dbh->prepare( $delete->sql() );
    $sth->execute( $delete->values({ id => $store1_id });
    $sth->execute( $delete->values({ id => $store2_id });

DESCRIPTION ^

The delete query is a very lightweight wrapper around SQL::Abstract's delete() method and provides no additional SQL syntax.

Instances of this class should be created using "delete" in SQL::Abstract::Query.

This class applies the SQL::Abstract::Query::Statement role.

ARGUMENTS ^

table

See "Table" 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.

syntax highlighting: