DBIx::Placeholder::Named - DBI with named placeholders
use DBIx::Placeholder::Named;
my $dbh = DBIx::Placeholder::Named->connect($dsn, $user, $password) or die DBIx::Placeholder::Named->errstr;
my $sth = $dbh->prepare( q{ INSERT INTO some_table (this, that) VALUES (:this, :that) } ); or die $dbh->errstr;
$sth->execute({ this => $this, that => $that, });
$DBIx::Placeholder::Named::PREFIX = '__'; $DBIx::Placeholder::Named::SUFFIX = '**';
my $sth = $dbh->prepare( q{ INSERT INTO some_table (this, that) VALUES (__this**, __that**) } );
DBIx::Placeholder::Named is a subclass of DBI, which implements the ability to understand named placeholders.
This variable holds the placeholder's prefix, being set to ':' by default. You can override it like this:
$DBIx::Placeholder::Named::PREFIX = '__';
This variable holds the placeholder's suffix, being set to '' by default. You can override it like this:
$DBIx::Placeholder::Named::SUFFIX = '**';
This method, overloaded from DBI, is responsible to create a prepared statement for further execution. It is overloaded to accept a SQL query which has named placeholders, like:
SELECT a, b, c FROM t WHERE id = :id
It uses SQL::Tokenizer to correctly tokenize the SQL query, preventing extract erroneous placeholders (date/time specifications, comments, inside quotes or double quotes, etc).
Copyright (c) 2007, Igor Sutton Lopes ">"
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.