The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SQL::Abstract::Query::Insert - An object that represents a SQL INSERT.

SYNOPSIS

    use SQL::Abstract::Query;
    my $query = SQL::Abstract::Query->new( $dbh );
    
    # Insert a new country:
    my ($sql, @bind_values) = $query->insert( 'country', { country=>$name } );
    $dbh->do( $sql, undef, @bind_values );
    
    # Use the OO interface to re-use the query and insert multiple countries:
    my $insert = $query->insert( 'country', ['country'] );
    my $sth = $dbh->prepare( $insert->sql() );
    $sth->execute( $insert->values({ country => $country1_name });
    $sth->execute( $insert->values({ country => $country2_name });

DESCRIPTION

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

Instances of this class should be created using "insert" 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.

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.