[CDBI] Reserved words in MySQL

Carlos Vicente <cvicente-zZ82ZiX1S8l+u43qRgrggVnYRNhDb3e+9nwVQlTi/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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"), so
I get:

Connection can't SELECT id, name, entity, nearend, farend
FROM Connection
: DBD::mysql::st execute failed: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'Connection' at line 2 [for Statement "SELECT
id, name, entity, nearend, farend
FROM Connection
"] at /usr/lib/perl5/site_perl/5.8.7/DBIx/ContextualFetch.pm line 52.


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.  

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.

Any thoughts?

cv
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.