[Dbix-class] Docs correction (?)
    Jesse Sheidlower 
    jester at panix.com
       
    Mon Apr 10 05:01:48 CEST 2006
    
    
  
I'm not entirely sure about this, hence my sending this as a
question rather than a patch:
In Intro.pod:
---
The preferred way to generate complex queries is to provide a SQL::Abstract construct to search:
  my $rs = $schema->resultset('Album')->search({
    artist  => { '!=', 'Janis Joplin' },
    year    => { '<' => 1980 },
    albumid => [ 1, 14, 15, 65, 43 ]
  });
This results in something like the following WHERE clause:
  WHERE artist != 'Janis Joplin'
    AND year < 1980
    AND albumid IN (1, 14, 15, 65, 43)
---
I'm pretty sure that this actually generates:
   [...]
   AND ( (albumid = 1) OR (albumid = 14) OR (albumid = 15 # ...
and that if you want to get the specified SQL you need:
   albumid => { 'in', [1, 14, 15, 65, 43] }
There's also the question of whether the approved format for the
hashref is { '!=', 'Janis Joplin' } or { '<' => 1980 }, with the
comma or => operator; I'll leave that for you guys who grok
Perl style, but we should be consistent.
Jesse Sheidlower
    
    
More information about the Dbix-class
mailing list