如何在 SQLite WHERE 子句中包含布尔值 [英] How to include a boolean in an SQLite WHERE clause
本文介绍了如何在 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.
这篇关于如何在 SQLite WHERE 子句中包含布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文