Why not adopt me?
NAME
Class::DBI::Plugin::Backtickify - surround column and table names with backticks
SYNOPSIS
package Film;
use base qw( Class::DBI );
use Class::DBI::Plugin::Backtickify; # must come after the use base
DESCRIPTION
Puts backticks around table and column names. This allows reserved words to be used as column (and table?) names in MySQL (and others?).
CAVEATS
It works by installing a transform_sql
method into your CDBI class. Other modules and plugins maybe do the same thing, in which case they may not play nicely with this. It does go through some hoops however to try and call other transform_sql
methods, but all the replacement tags will already have been removed so this might not help anyway. YMMV.
The installed transform_sql
finds column names using a regex over each @args
passed in. If strings matching column names (but not supposed to represent column names) exist as words in the input to the method, they will also get wrapped. Not sure how likely this is.
I haven't tested if this works with joins, but it should.
No tests yet.
METHODS
- transform_sql
AUTHOR
David Baird, <cpan@riverside-cms.co.uk>
BUGS
Please report any bugs or feature requests to bug-class-dbi-plugin-backtickify@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-DBI-Plugin-Backtickify. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2005 David Baird, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.