Null values in Transfer are covered in the wiki: see
http://docs.transfer-orm.com/wiki/Handling_Null_Values.cfm

If you have nullable="true" for a property and you set the property to an
empty string, the corresponding column will be set to NULL on save. When you
read the column back, the property is populated with an empty string.

If you have nullable="false" for a property and you set the property to an
empty string, the corresponding column will be set to an empty string on
save. When you read the column back, the property is populated with an empty
string.

If you want to be able store both NULLs and empty strings in the same
column, you must set the nullvalue attribute to some other string that will
never be used for a real value. Keep in mind that if you do this, calling
the getter method on the property when it contains a NULL will return
whatever string you chose for the nullvalue attribute, and if you ever call
the setter method with that nullvalue value, the column will be set to NULL
on save (not the nullvalue value).

Does that make sense?

-- Dennis

On Tue, Aug 17, 2010 at 3:07 PM, pedrobl <pe...@bezunartea.net> wrote:

>
> Hi!
>
> I tried searching in the forums for this issue, but could not find
> anything relevant. I thought having nullable="false" in a property
> would prevent a null from being inserted in the database. To test it I
> tried to submit an empty textbox to that field and to my surprise, an
> empty string, literally '' got stored into the database. :P
>
> Do I need to replace the setter for that property to check for empty
> string? Shouldn't transfer insert a database null when an empty string
> is stored in a field?
>
> TIA,
>
> Pedro.
>
>

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

You received this message because you are subscribed to the Google Groups 
"transfer-dev" group.
To post to this group, send email to transfer-dev@googlegroups.com
To unsubscribe from this group, send email to 
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to