[Dbix-class] ENUM values from MySQL using the column_info()

Zbigniew Lukasiak zzbbyy at gmail.com
Fri May 12 14:44:34 CEST 2006


Now when you have $record->name in DBIC and 'NAME' in the database
everything works all right except the 'column_info'.

I don't really know how important is that issue - but I was asked to
fix it when I wrote the 'column_info' accessor and I was critisized to
not know what exactly to do with it.

--
Zbyszek


On 5/12/06, Jess Robinson <castaway at desert-island.demon.co.uk> wrote:
>
>
> On Fri, 12 May 2006, Zbigniew Lukasiak wrote:
>
> > On 5/12/06, Carl Franks <fireartist at gmail.com> wrote:
> >> As far as I know, DBIx::Class doesn't make any effort to try to be
> >> case-insensitive, but if your database is, then DBIx::Class may appear
> >> to be case-insensitive.
> >
> > I don't know how much conscious effor there is but if I have a table
> > with two columns with names differing only by case:
> >
> > test=# select * from casecheck;
> > id | name | NAME
> > ----+------+------
> >  1 | aaa  | AAA
> > (1 row)
> >
> > (this is Pg)
> >
> > and I define DBIC class columns with the same case:
> >
> > __PACKAGE__->add_columns(qw/id name NAME/);
> >
> >
> > Then when I retrieve the record and print the values in it's columns:
> > my $record = $schema->resultset( 'Casecheck' ) -> find ( 1 );
> > print "record->name: ", $record->name, "\n";
> > print "record->NAME: ", $record->NAME, "\n";
> >
> > I get:
> >
> > record->name: aaa
> > record->NAME: aaa
> >
> > While I would expect the last line to be: record->NAME: AAA
> >
> > Summing up - the database is casesensitive, but in DBIC is not (in this case:).
> >
>
> No, that's DBIC throwing : SELECT me.name, me.NAME from Casecheck at your
> database, and expecting it to do something sane. Apparently Pg doesnt,
> you'd need to turn on quoting to get that to work..
>
> DBIC's column name accessors ARE case sensitive, its just that Pg is
> returning the contents of the "name" column both times.. try it on the
> pgsql util?
>
> To fix: $schema->storage->quote_char("'") .. or whatever Pg wants it to
> be..
>
> I cant see this being a huge problem, as who names their columns the same
> but in different case anyway??
>
> Jess
>
>
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
>


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the Dbix-class mailing list