On 3/2/18, Olivier Mascia <o...@integral.be> wrote:
>
> What values will be considered FALSE, and hence will TRUE be NOT FALSE or
> equality to some other specific value?

I have a note to provide additional documentation on this before the release.

In short, a value is FALSE is, when converted into a floating point
number via CAST(x AS REAL) it has a value of 0.0.

It used to be (https://www.sqlite.org/src/info/36fae083b450e3af) that
sometimes FALSE was determined by CAST(x AS INTEGER).  This was
inconsistent.  Beginning with 3.23.0, FALSE is determined by CAST(x AS
REAL) in all cases.

So in other words, it used to be that 0.5 was sometimes considered
TRUE and other times considered FALSE, depending on context.  It is
now always considered TRUE.

Strings are TRUE or FALSE depending on whether or not they evaluate to
non-zero when converted.  '123xyz' is TRUE, but '0abc', 'abc', and ''
are all FALSE.


> Will insert into T values(FALSE) actually store integer 0 no matter column
> affinity or will it follow affinity?

No.  FALSE is merely an alias for 0.  Affinity still applies.  If the
column is of type TEXT, then it will store '0', not 0.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to