[CDBI] Reserved words in MySQL

Rhesa Rozendaal perl at rhesa.com
Tue Dec 12 23:24:48 GMT 2006


Carlos Vicente wrote:
> Hi all,
> 
> After upgrading to MySQL5 I started getting errors caused by some of my
> tables having names that are now reserved words (e.g. "Connection")


> In looking for possible solutions, I noticed the table_alias method, but
> I'm not convinced that that's of any use here.  I'm trying to not have
> to rename the table.  

You could just do

   __PACKAGE__->table('`Connection`');

or prefix it with the database name:

   __PACKAGE__->table('your_db_name.Connection');

> I fixed the db creation scripts by wrapping the table names in backticks
> (``), but I can't control how Class::DBI builds its SQL.  It'd be great
> if this could be turned on somewhere globally.

HTH,

Rhesa



More information about the ClassDBI mailing list