GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SQL::NamedPlaceholder(3) User Contributed Perl Documentation SQL::NamedPlaceholder(3)

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.

($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 array reference of bind parameters.

:foobar
Replace as placeholder which uses value from $hash->{foobar}.
foobar = ?, foobar > ?, foobar < ?, foobar <> ?, etc.
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.
2016-06-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.