[Dbix-class] bad column names?

fREW Schmidt frioux at gmail.com
Tue Mar 10 05:14:54 GMT 2009


On Mon, Mar 9, 2009 at 5:24 PM, fREW Schmidt <frioux at gmail.com> wrote:

> Hi all!
>>>
>>> We are dealing with some weird issues because our database has silly
>>> column names.  Specifically speaking we have a column called 'user'.  u=
ser
>>> 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/Manu=
al/Cookbook.pod#Setting_quoting_for_the_generated_SQL<http://search.cpan.or=
g/%7Eribasushi/DBIx-Class-0.08012/lib/DBIx/Class/Manual/Cookbook.pod#Settin=
g_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 sa=
me
> 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?
>

We figured it out.  Our ancient repos (activestate) only had up to version
.06000 and we had issues updating.  After that everything worked.


-- =

fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090310/881=
59934/attachment-0001.htm


More information about the DBIx-Class mailing list