SQL::NamedPlaceholder - extension of placeholder
use SQL::NamedPlaceholder qw(bind_named); my ($sql, $bind) = bind_named(q[ SELECT * FROM entry WHERE user_id = :user_id ], { user_id => $user_id }); $dbh->prepare_cached($sql)->execute(@$bind);
SQL::NamedPlaceholder is extension of placeholder. This enable more readable and robust code.
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 array reference of bind parameters.
Replace as placeholder which uses value from $hash->{foobar}.
This is same as 'foobar = :foobar'.
cho45 <cho45@lowreal.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install SQL::NamedPlaceholder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::NamedPlaceholder
CPAN shell
perl -MCPAN -e shell install SQL::NamedPlaceholder
For more information on module installation, please visit the detailed CPAN module installation guide.