Class::DBI::Plugin::Backtickify - surround column and table names with backticks
package Film; use base qw( Class::DBI ); use Class::DBI::Plugin::Backtickify; # must come after the use base
Puts backticks around table and column names. This allows reserved words to be used as column (and table?) names in MySQL (and others?).
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.
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.
Please report any bugs or feature requests to
email@example.com, 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.
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.