2008年8月21日星期四

Re: [fw-db] Zend_Db and NULL values

Are you trying to "quote" the null value? You might want to try this instead:

<?php

$select = $table->select()
->where('parent_id IS NULL')
->where('user_id IS NOT NULL')
;

?>


I hope this helps.

-Hector

Arthur M. Kang wrote:
Is it just me?  It seems like the Zend_Db classes and gateways do not handle NULL values very well (or at all).   All databases differentiate between NULL and ''.  For select, save, find, create, and other various methods, how does everyone handle NULL values?  In my opinion, it would be nice if these were handled by the classes.

array('key' => NULL) should be valid and should be different than array('key' => '')

        $a = array();
        $a['key'] = NULL;
        $a['key2'] = '';
        Zend_Debug::Dump($a);

If I'm out to lunch, somebody please enlighten me and point me in the right direction.  :-)

Any help is appreciated.

Arthur

没有评论: