Fey::SQL::Insert - Represents a INSERT query
my $sql = Fey::SQL->new_insert(); # INSERT INTO Part # (part_id, name, quantity) # VALUES # (?, ?, ?) $sql->insert()->into($Part); my $ph = Fey::Placeholder->new(); $sql->values( part_id => $ph, name => $ph, quantity => $ph, ); print $sql->sql($dbh);
This class represents a INSERT query.
INSERT
This class provides the following methods:
To construct an object of this class, call $query->insert() on a Fey::SQL object.
$query->insert()
Fey::SQL
This method is basically a no-op that exists to so that Fey::SQL has something to call after it constructs an object in this class.
This method specifies the INTO clause of the query. It expects a list of Fey::Column and/or Fey::Table objects, but not aliases.
INTO
If you pass a table object, then the INTO will include all of that table's columns, in the order returned by the $table->columns() method.
$table->columns()
Most RDBMS implementations only allow for a single table here, but some (like MySQL) do allow for multi-table inserts.
This method takes a hash reference where the keys are column names, and values are the value to be inserted for that column. Each value can be of the following:
a plain scalar, including undef
This will be passed to Fey::Literal->new_from_scalar().
Fey::Literal->new_from_scalar()
Fey::Literal object
Fey::Literal
Fey::Placeholder object
Fey::Placeholder
Returns the full SQL statement which this object represents. A DBI handle must be passed so that identifiers can be properly quoted.
See the Fey::SQL section on Bind Parameters for more details.
Dave Rolsky, <autarch@urth.org>
See Fey for details on how to report bugs.
Copyright 2006-2008 Dave Rolsky, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Fey, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fey
CPAN shell
perl -MCPAN -e shell install Fey
For more information on module installation, please visit the detailed CPAN module installation guide.