SQL::NamedPlaceholder - extension of placeholder
use SQL::NamedPlaceholder;
my ($sql, $bind) = bind-named(q[
SELECT *
FROM entry
WHERE
user_id = :user_id
], {
user_id => $user_id
});
$dbh.prepare($sql).execute(|$bind);
SQL::NamedPlaceholder is extension of placeholder. This enable more readable and robust code.
[$sql, $bind] = bind-named($sql, $hash);
The $sql parameter is SQL string which contains named placeholders. The $hash parameter is map of bind parameters.
The returned $sql is new SQL string which contains normal placeholders ('?'), and $bind is List of bind parameters.
Replace as placeholder which uses value from $hash{foobar}.
foobar = ?, foobar > ?, foobar < ?, foobar <> ?, etc.
This is same as 'foobar (op.) :foobar'.
Asato Wakisaka
This module is a port of SQL::NamedPlaceholder in Perl.
Author of original SQL::NamedPlaceholder in Perl is cho45.
Copyright 2016 - 2018 Asato Wakisaka
Copyright 2024 Raku Community
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
Original Perl's SQL::NamedPlaceholder is licensed under following terms:
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.