[Dbix-class] expressing IS NULL

Matt S Trout dbix-class at trout.me.uk
Sun Aug 20 20:20:45 CEST 2006


Len Jaffe wrote:
> In order to have an "AND mydate IS NULL" criterion as part of a query,
> I ende dup having to chain a search_literal() on the end of a search() 
> becuase
> every way I expressed it in the search() criteria hash, I ended up with 
> errors when
> the string literal 'NULL' was bound to the column mydate.

That's because you didn't read the SQL::Abstract docs.

{ mydate => undef }

automatically gets translated to IS NULL.

{ mydate => { '!=', undef } }

automatically gets translated to IS NOT NULL.

-- 
      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/ +



More information about the Dbix-class mailing list