[Dbix-class] Automatic quoting

Toby Corkindale toby.corkindale at strategicdata.com.au
Mon Jun 7 05:04:23 GMT 2010


On 04/06/10 19:02, Will Hawes wrote:
> Yesterday a colleague new to DBIC ran into a problem with a column
> named using a reserved word in MySQL. He worked around it by using a
> different column name, but while discussing the issue he asked why
> quote_char and name_sep are not set automatically. I don't know the
> answer and Googling has left me none the wiser.
>
> I'd have thought that if the dsn contains "dbi:mysql", it should be
> safe to assume that quote_char should be "`" and so on - the unsafe
> cases being things like "dbi:ODBC" where you can't determine the
> database from the dsn (although there may be other ways to work it out
> from $schema->storage->dbh).
>
> Is there a reason for only allowing quoting to be set up manually, or
> is this a case of patches welcome?

Only speaking on behalf of myself, but I see:

1) You shouldn't be making db tables or columns based on reserved words 
anyway, as sooner or later someone will want to log in manually to do 
something in SQL, and be cursing you.

2) it makes debugging output much harder to read. (Because it takes up 
more space, and also looks ugly.)



More information about the DBIx-Class mailing list