NAME
DBIx::Placeholder::Named - DBI with named placeholders
SYNOPSIS
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**) }
);
DESCRIPTION
DBIx::Placeholder::Named is a subclass of DBI, which implements the ability to understand named placeholders.
VARIABLES
- $DBIx::Placeholder::Named::PREFIX
-
This variable holds the placeholder's prefix, being set to ':' by default. You can override it like this:
$DBIx::Placeholder::Named::PREFIX = '__';
- $DBIx::Placeholder::Named::SUFFIX
-
This variable holds the placeholder's suffix, being set to '' by default. You can override it like this:
$DBIx::Placeholder::Named::SUFFIX = '**';
METHODS
- DBIx::Placeholder::Named::db::prepare()
-
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).
- DBIx::Placeholder::Named::st::execute()
AUTHOR
Copyright (c) 2007, Igor Sutton Lopes "<IZUT@cpan.org>". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.