[Dbix-class] Case sensitivity in column names using Oracle

Zbigniew Lukasiak zzbbyy at gmail.com
Thu Feb 16 19:34:59 CET 2006


In DBIC in Pg upper and lower case accessors return the same data.  Is
that a bug or feature?  If that's feature than I can do something
similar.

My test script:

package My::App::Model::DBICmodel;
use strict;
use warnings;
use base qw/DBIx::Class DBIx::Class::WebForm/;
__PACKAGE__->load_components(qw/PK::Auto::Pg Core DB/);
__PACKAGE__->connection('dbi:Pg:dbname=CE', '', '');

package My::App::Model::DBICmodel::FooBar;
use lib 'My-App/lib';
use base 'My::App::Model::DBICmodel';
__PACKAGE__->table('foo_bar');
__PACKAGE__->add_columns(qw/id TEXTFIELD textfield varcharfield
charfield integerfield/);
__PACKAGE__->set_primary_key('id');

package Main;
my $a   = My::App::Model::DBICmodel::FooBar->search(id => 2)->next;
print "TEXTFIELD: " . $a->TEXTFIELD . "\n";
print "textfield: " . $a->textfield . "\n";

__OUTPUT__
TEXTFIELD: bbb
textfield: bbb


In my database I have:

CE=# select * from foo_bar;
 id | textfield | varcharfield | charfield | integerfield | TEXTFIELD
----+-----------+--------------+-----------+--------------+-----------
  2 | bbb       | add          |           |              | aaa
(1 row)

-- Zbyszek

On 2/14/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Tue, Feb 14, 2006 at 07:32:21AM -0800, Stephan Szabo wrote:
> >
> > On Tue, 14 Feb 2006, Matt S Trout wrote:
> >
> > > On Tue, Feb 14, 2006 at 11:31:12AM +0100, Karl.Moens at marsh.com wrote:
> > > > Matt wrote:
> > > >
> > > > > does anybody know if
> > > > > there are any databases that'll let you have foo, Foo and FOO all as
> > > > column
> > > > > names on the same table?
> > > >
> > > > At least MySQL does not allow you to have colums with names which only
> > > > differ because of their case.
> > >
> > > Yeah, I already knew that. Trouble is what we need to know is if that's
> > > the general case - one exception would cause breakage for people using said
> > > exceptional DB and I'd prefer to avoid that if possible :)
> >
> >
> > The spec explicitly seems to allow "FOO" and "foo" and "Foo" (with the
> > quotes) as distinct identifiers. Paraphrased: two delimited identifiers
> > are equivalent if their inner parts considered as a character string
> > literal compare equally with an implementation-defined collation that is
> > sensitive to case.  I know postgres should do this part properly (although
> > it gets the case-folding for non-delimited identifiers wrong).
>
> Thought as much :)
>
> However, assinging column-info for Foo to a column called 'foo' or 'FOO'
> *if* there's no declared column 'Foo' should be relatively reasonable, right?
>
> If you have both, it won't matter. Hmm ... y'know, it'd probably be much
> easier just top make columns_info_for actually ask for the column names
> in the ResultSource rather than its current hackish %/* approach.
>
> Zbigniew, fancy doing another revision of your columns_info_for code that
> gets passed the $source object and does it that way?
>
> --
>      Matt S Trout       Offering custom development, consultancy and support
>   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
> Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information
>
>  + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
>
> _______________________________________________
> 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/
>


More information about the Dbix-class mailing list