SQL::Functional Cookbook: Inserts
2017-04-01
We can build an insert statement easily, too.
my ($sql, @sql_params) = INSERT INTO 'foo',
[
'bar',
],
VALUES [
1,
];
INTO
takes a table, which it feeds to INSERT
. The INSERT
function likewise takes a list of table columns (in an array ref), followed by VALUES
, which itself takes an arrayref of the data you’re going to put into the columns. All the scalars in that arrayref are passed back in @sql_params
and filled in as placeholders.
Inserting with a subselect is supported, which we will cover later.