[Dbix-class] bad column names?

fREW Schmidt frioux at gmail.com
Mon Mar 9 22:24:00 GMT 2009


>
> Hi all!
>>
>> We are dealing with some weird issues because our database has silly
>> column names.  Specifically speaking we have a column called 'user'.  us=
er
>> 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 =3D ?
>> )': [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/Manua=
l/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 =3D My::Schema->connect("dbi:ODBC:DSN=3DLynxSQL",

"Test_Lornx","Password1!", {

                                quote_char =3D> [qw/[ ]/],

                                name_sep  =3D> '.',

                                limit_dialect =3D> 'mssql',

                            });


> my $parent =3D $schema->resultset('LogParent')->find(62);

print $parent->subject;


> my @equip =3D $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 =3D ?
> )': [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near the
> keyword 'user'. (SQL-42000)


Anyone see what I am missing?
-- =

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090309/4ff=
427bb/attachment.htm


More information about the DBIx-Class mailing list