[Dbix-class] bad column names?

Jesper Krogh jesper at krogh.cc
Mon Mar 9 19:18:11 GMT 2009


fREW Schmidt 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'. 
>  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 <http://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?

Try putting:

sub setup {
     my $self = shift;
     $self->storage->sql_maker->limit_dialect('mssql');
     $self->storage->sql_maker->quote_char([qw/[ ]/]);
     $self->storage->sql_maker->name_sep('.');
     return $self;
}


in your DBIx::Class::Schema class.

-- 
jesper



More information about the DBIx-Class mailing list