Mistake on boolean sqlite stored ?

Hi to all. I use XoJo 2014 vers. 3.1 And obviusly Sqlite 3.8.5

I have notice this strange storage:
Note: Me.Pagato is a Boolean value from RadioButton

Dim row As New DatabaseRecord ... row.BooleanColumn("Pagato") = Me.Pagato ...
In Sqlite database file is stored as 0 (or 1)

rs.Edit ... rs.Field("Pagato").BooleanValue = Me.Pagato ...
In Sqlite database file is stored as False (or True)

NOTE: The “Pagato” field is stored as INTEGER !

As per SQlite documentation, boolean statements are stored as 0 or 1.


[quote]1.1 Boolean Datatype

SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).[/quote]

SQLite has only five data types: NULL, 64bit Integer, double, text and blob.
So booleans are integers internally.
But your sqlite app showing records may show them as True and False if it looks on column type.

As long as rs.Field(“Pagato”).BooleanValue returns the correct result in either case, it’s nothing to worry about. Sqlite is very loosely typed.

Yes, xojo works regularly. Perhaps the external App interprets differently the file (sometimes true sometimes 1). But also SQLiteManager !

Xojo works, then that’s fine.
However, XoJo’s programmers further investigations.

Thanks to all for replies :slight_smile: