szeiger/scala-query — Issue #31: Verify data against definition
Author: macias
Created: 2012-01-08 13:20:57+00:00
State: open

Due to design decision of SQ SQL-nulls are not mapped into Scala nulls.

However, they are not validated. For example -- if you have column with nulls in DB, and you won't define the column as Option + O.Nullable in SQ, your data will be _casted_ into default value for the type (not null though).

The design of SQ is one matter, but this leak is another issue -- data should be not casted, but checked instead. If one has DB definition and SQ definition and they are not compatible with each other, the exception should be thrown.

This leak is nasty, I am writing this report after spending around 1.5 day of watching, verifying, etc. perfect code with one exception -- I forgot to add Option in column definition and the datatime nulls were saved as 1970-something.

Summary: since by design Scala nulls not used for SQL-nulls, they are invalid entities. Usage of such entities should be forbidden, not silently accepted.