There is no single Boolean Storage Class in the sqlite database, and the Booean value is stored in integers 0 (false) and 1 (true). In my practice, there are three statuses of boolean, 0 (false) 1 (true) and null, as shown in, can be successfully inserted after the following insert statement, test. in addition, you can use the select * fromstuwhereflag Database
There is no single Boolean Storage Class in the sqlite database, and the Booean value is stored in integers 0 (false) and 1 (true). In my practice, there are three statuses of boolean, 0 (false) 1 (true) and null, as shown in, can be successfully inserted after the following insert statement, test. in addition, you can select * from stu where flag = Database
There is no single Boolean Storage Class in the sqlite database, and the Booean value is stored in integers 0 (false) and 1 (true). In my practice, there are three statuses of boolean, 0 (false) 1 (true) and null, as shown in,
The following insert statement can be successfully inserted.
Select * from stu where flag = "Database"
The row named a9 is queried.
Insert into stu (name, flag) values ('a1', 'true'); -- 0
Insert into stu (name, flag) values ('a2 ', 'ture'); -- 0
Insert into stu (name, flag) values ('a3 ', 1); -- 1
Insert into stu (name, flag) values ('a4 ', 'null'); -- 0
Insert into stu (name, flag) values ('a5 ', '1'); -- 1
Insert into stu (name, flag) values ('a6 ', null); -- 2
Insert into stu (name, flag) values ('a7 ', '2'); -- 1
Insert into stu (name, flag) values ('a8 ', 15); -- 1
Insert into stu (name, flag) values ('a9 ', "Database"); -- 0
When exporting the database, you can find that the SQL statement executed is like this,
Insert into [stu] values ('a1', 0 );
Insert into [stu] values ('a2 ', 0 );
Insert into [stu] values ('a3 ', 1 );
Insert into [stu] values ('a4 ', 0 );
Insert into [stu] values ('a5 ', 1 );
Insert into [stu] values ('a6 ', null );
Insert into [stu] values ('a7 ', 1 );
Insert into [stu] values ('a8 ', 1 );
Insert into [stu] values ('string', 0 );
Insert into [stu] values ('string2', 0 );
Insert into stu (name, flag) values ('a9 ', 0); -- 0
In this case, we assume that sqlite uses the boolean type data inserted by the stable type storage. However, during the extraction, the inserted string type data is converted to the int type for use.
Therefore, we can draw the following conclusion:
-- The character can be converted to true of the int type, false (0) for conversion failure, integer for int, long double, true (1), Boolean error, null is null
Ps: I have not yet had a deep understanding of it. Currently, it is the conclusion of practical testing. It is purely a guess. If you have any suggestion, please let us know.
,