SQLite 中是否有布尔文字?

Is there a boolean literal in SQLite?(SQLite 中是否有布尔文字?)
本文介绍了SQLite 中是否有布尔文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 boolean 列类型,但是在 SQLite 中有 boolean literal 吗?在其他语言中,这可能是 truefalse.显然,我可以使用 01,但我倾向于尽可能避免使用所谓的幻数".

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 Boolean Datatype 文档:

SQLite 没有单独的布尔存储类.相反,布尔值存储为整数 0(假)和 1(真).

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

所以看起来你被 01 卡住了.

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

这篇关于SQLite 中是否有布尔文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

FastAPI + Tortoise ORM + FastAPI Users (Python) - Relationship - Many To Many(FastAPI+Tortoise ORM+FastAPI用户(Python)-关系-多对多)
Window functions not working in pd.read_sql; Its shows error(窗口函数在pd.read_sql中不起作用;它显示错误)
(Closed) Leaflet.js: How I can Do Editing Geometry On Specific Object I Select Only?((已关闭)Leaflet.js:如何仅在我选择的特定对象上编辑几何图形?)
in sqlite update trigger with multiple if/Case Conditions(在具有多个IF/CASE条件的SQLite UPDATE触发器中)
Android: Why is Room so slow?(Android:为什么Room这么慢?)
Remote Procedure call failed with sql server 2008 R2(使用 sql server 2008 R2 的远程过程调用失败)