是否有一个布尔值SQLite中? [英] Is there a boolean literal in SQLite?

查看:129
本文介绍了是否有一个布尔值SQLite中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道关于布尔字段类型的,但有一个布尔 文字的SQLite中?在其他语言中,这可能是真正。很显然,我可以使用 0 1 ,但是我倾向于避免所谓的幻数在可能的情况。

I know about the boolean column type, but is there a boolean literal in SQLite? In other languages, this might be true or false. Obviously, I can use 0 and 1, but I tend to avoid so-called "magic numbers" where possible.

列表,似乎像它可能在其它SQL实现存在,但不是SQLite的。 (我使用SQLite 3.6.10,对于它的价值。)

From this list, it seems like it might exist in other SQL implementations, but not SQLite. (I'm using SQLite 3.6.10, for what it's worth.)

推荐答案

这部分 1.1布尔数据类型的文档的:

SQLite不具有单独的布尔存储类。相反,逻辑值被存储为整数0(假)和1(真)。

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

所以看起来你被卡住 0 1

So it looks like you are stuck with 0 and 1.

这篇关于是否有一个布尔值SQLite中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆