To get null from database instead of empty strings you need to set up your DB connection as follows:
'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=test', 'username' => 'root', 'password' => '', 'charset' => 'utf8', // here it is: 'nullConversion' => PDO::NULL_EMPTY_STRING, ),
Total 2 comments
Thanks for correction. Fixed.
I tried it with PDO_MYSQL driver and it seems that the conversion occurs on read operations and not on save, which can make a significant difference in some circumstances (e.g. nullable temporal columns, queries using IS NULL).
Leave a comment
Please login to leave your comment.