Grokbase
x

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

View PostFlat  Thread  Threaded | < Prev - Next >
Matt S Trout Re: [Dbix-class] How to search records with "IS NOT NULL"
| +1 vote
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
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/

_______________________________________________
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/
Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/

Thread : [Dbix-class] How to search records with "IS NOT NULL"
1)
Ramprabhu Kaliaperumal Hi All I want something like 'SELECT * FROM employee WHERE department IS NOT NULL' I tried...
2)
Matt S Trout SQL::Abstract and DBIx::Class both treat undef as NULL. Just pass => { '!=', undef } and it'll do...
3)
Fernan Aguero | Hi All | I want something like 'SELECT * FROM employee WHERE department IS NOT NULL' | I tried...
4)
Jason Thaxter Any suggestions on how to use the overlaps operator? Using Postgresql.. I read the SQL::Abstract...
spacer
View PostFlat  Thread  Threaded | < Prev - Next >