In Delphi code, NULLable types do not exist as such. There is no
native int?
type, as in C#.
But at SQL and JSON levels, the NULL value does exist and should be converted
as expected by the ORM.
In SQLite3 itself, NULL is handled as stated in http://www.sqlite.org/lang_expr.html
(see e.g. IS
and IS NOT
operators).
It is worth noting that NULL handling is not consistent among all existing
database engines, e.g. when you are comparing NULL with non NULL values... so
we recommend using it with care in any database statements, or only with proper
(unit) testing, when you switch from one database engine to another.
By default, in the mORMot ORM/SQL code, NULL will appear only in
case of a BLOB storage with a size of 0
bytes.
Otherwise, you should not see it as a value,
in most kinds of ORM properties.
Null-oriented value types have been implemented in our framework, since the object pascal language does not allow defining a nullable type (yet).
We choose to store those values as variant
, with a set of
TNullable
dedicated types, as defined in
mORMot.pas
:
type TNullableInteger = type variant; TNullableBoolean = type variant; TNullableFloat = type variant; TNullableCurrency = type variant; TNullableDateTime = type variant; TNullableTimeLog = type variant; TNullableUTF8Text = type variant;