Andrew Sweger > DBIx-NamedBinding > DBIx::NamedBinding

Download:
DBIx-NamedBinding-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.02   Source  

NAME ^

DBIx::NamedBinding - use named parameters instead of '?'

VERSION ^

Version 0.01

SYNOPSIS ^

This module subclasses the DBI and allows you to use named query parameter placeholders instead of positional '?'.

    use DBI;

    my $dbh = DBI->connect($dsn, {
        RootClass => 'DBIx::NamedBinding',
    } );
    my $sth = $dbh->prepare('
        SELECT * FROM foo WHERE
            price        <     :price     AND
            sale_price   =     0          AND
            location     =     :location  AND
            inventory    >     :inventory AND
            sku          LIKE  :sku
    ');
    $sth->bind_param( price     => 14.95  );
    $sth->bind_param( location  => 'BMWH' );
    $sth->bind_param( inventory => 4      );
    $sth->bind_param( sku       => 'OH%'  );

    my $rv = $sth->execute();

Other than that, just use it like one would use the DBI.

AUTHOR ^

Andrew Sweger, <yDNA at cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-dbi-namedbinding at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBI-NamedBinding. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc DBIx::NamedBinding

You can also look for information at:

ACKNOWLEDGEMENTS ^

My thanks to Colin Meyer for turning me on to the evils of subclassing the DBI.

COPYRIGHT & LICENSE ^

Copyright 2008 Andrew Sweger, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: