[Dbix-class] How to search records with "IS NOT NULL"

Matt S Trout dbix-class at trout.me.uk
Tue Jul 24 18:30:05 GMT 2007


On Tue, Jul 24, 2007 at 10:15:51PM +0530, Ramprabhu Kaliaperumal wrote:
> Hi All
> 
> I want something like 'SELECT * FROM employee WHERE department IS NOT NULL'
> 
> I tried $schema->resultset('employee')->search({ department => {"IS" => 
> "NOT NULL"}});

SQL::Abstract and DBIx::Class both treat undef as NULL. Just pass

=> { '!=', undef }

and it'll do the right thing.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list