如何在 SQLite WHERE 子句中包含布尔值
问题描述:
我没有得到任何结果.如何在 SQLite 的 where
子句中包含布尔条件?
I get no results. How can I include a boolean conditional in a where
clause in SQLite?
我已经尝试过这些
"Select * from table where col = 1"
"Select * from table where col = '1'"
"Select * from table where col = true"
"Select * from table where col = 'true'"
"Select * from table where col = 'True'"
"Select * from table where col is True"
没什么.我什至尝试在查询函数中包含true"作为 whereArgs.
Nothing. I even tried including "true" as the whereArgs in a query function.
我该如何解决?
答
SQLite 没有单独的布尔存储类.相反,布尔值存储为整数 0 (false) 和 1 (true).
SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).
来源:SQLite
第一个听起来是正确的.
The first one then sounds correct.