[Catalyst] update_or_create problem with Catalyst::Engine::Apache::MP13 and DBIC

Matt S Trout dbix-class at trout.me.uk
Fri May 26 17:23:13 CEST 2006


Anthony Lincoln wrote:
> Followup: the problem stems from one of those classic Oracle-with-DBI 
> not-quite-case-insensitive moments.
> 
> Such that this fails:
> 
>               my $outage = $model->update_or_create({
>                   id => $id,
>                   problem_ticket => $outage{problem_ticket},
>                   creator => $creator,
>               },{ key => 'primary' } );
> 
> but *this* works:
> 
>               my $outage = $model->update_or_create({
>                   ID => $id,  #note the case difference
>                   problem_ticket => $outage{problem_ticket},
>                   creator => $creator,
>               },{ key => 'primary' } );
> 
> I've seen this before, when using plain DBI hashrefs with columns as 
> keys, but I just assumed that DBIC was immune because everything else 
> works in lowercase.  It works as billed with Catalyst's standalone 
> server, but with Catalyst::Engine::Apache::MP13, explicitly not loading 
> Apache::DBI, it doesn't.

That's very odd; I don't quite see how the environment switch could make 
a difference.

> I wrote a DBIx::Class::Loader::Oracle based on 
> DBIx::Class::Loader::Generic, and it doesn't explicitly lc() primary 
> keys, so that's probably where the trouble starts.  I suppose I could do 
> that to make things consistent at least.  Did I read somewhere that this 
> is deprecated?

Yeah, have a look at DBIx::Class::Schema::Loader which is a much 
cleaner, more DBIC-ish design - DBIx::Class::Loader was a fast port of 
Class::DBI::Loader when DBIC was just getting started, and uses the 
DB.pm connection-as-classdata API which will eventually become 
CDBICompat-only.



More information about the Catalyst mailing list