[Dbix-class] bad column names?

Moritz Onken onken at houseofdesign.de
Tue Mar 10 06:55:12 GMT 2009


Am 09.03.2009 um 23:24 schrieb fREW Schmidt:

> Hi all!
>
> We are dealing with some weird issues because our database has silly  
> column names.  Specifically speaking we have a column called  
> 'user'.  user is a reserved word in T-SQL (we are using SQL  
> Server.)  Anyway, this is the error we get:
>
> DBIx::Class::ResultSet::find(): Error executing 'SELECT me.user,  
> me.password, me.site, me.image, me.ro FROM Users me WHERE ( me.user  
> = ? )': [Microsoft][SQL Native Client][SQL Server]Incorrect syntax  
> near the keyword 'user'. (SQL-42000)
>
> Is there a standard way around this?
>
> Thanks!
>
> There is:
>
> http://search.cpan.org/~ribasushi/DBIx-Class-0.08012/lib/DBIx/Class/Manual/Cookbook.pod#Setting_quoting_for_the_generated_SQL 
> .
>
> I actually couldn't get either of these solutions to work.  I asked  
> for help on the IRC Channel and I got this far:
>
> use lib '/Inetpub/wwwroot/cgi'; use My::Schema; use strict;
> my $schema = My::Schema->connect("dbi:ODBC:DSN=LynxSQL",  
> 								"Test_Lornx","Password1!",  
> {                                 quote_char => [qw/ 
> [ ]/],                                 name_sep  =>  
> '.',                                 limit_dialect =>  
> 'mssql',                             });
> my $parent = $schema->resultset('LogParent')->find(62); print  
> $parent->subject;
> my @equip = $schema->resultset('User')->find('test')->equipment;  
> print $equip[0]->serialnumber;
>
> But it still acts like I never set any of those settings and I get  
> the same error:
>
> DBIx::Class::ResultSet::find(): Error executing 'SELECT me.user,  
> me.password, me.site, me.image, me.ro FROM Users me WHERE ( me.user  
> = ? )': [Microsoft][SQL Native Client][SQL Server]Incorrect syntax  
> near the keyword 'user'. (SQL-42000)

SQL::Translator::Producer::SQLServer doesn't seem to honour quote_char  
and friends.

Can someone confirm?



More information about the DBIx-Class mailing list