[Dbix-class] HOWTO: quote table names in Schema::Loader

JChimene jchimene at gmail.com
Fri Mar 9 17:08:49 GMT 2007


Hi,

How do I quote table names in the SQL generated
by the Schema::Loader class?

The problem I'm trying to solve is that a
particular table name has become a
reserved word in a version of MySQL 
(i.e. table name "condition" is now a problem)

I've tried using
moniker_map => sub { return '"'.$_[0].'"' }

however, this /always/ quotes the name; which 
technique generates bad code. For
example, the table name ACCESS gets quoted in
the generated Perl code:
fori::inspect::"access"->load_components("PK::Auto", "Core");

I can rename the table, but that's a lot of work.

I'm also using Catalyst, but I don't think that's 
the issue here. I'm hoping that quoting in Storage::DBI 
class will work via the "quote_char" setting.
However, that may be a unreliable assumption.




More information about the Dbix-class mailing list