You are viewing revision #1 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.
To write null
instead of empty strings to database when saving empty values 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,
),
it actually works in the opposite direction
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).
Thanks
Thanks for correction. Fixed.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.