在 SQLite 中存储布尔值 [英] Store boolean value in SQLite

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

问题描述

SQLite 中 BOOL 值的类型是什么?我想在我的表中存储 TRUE/FALSE 值.

What is the type for a BOOL value in SQLite? I want to store in my table TRUE/FALSE values.

我可以创建一个 INTEGER 列并在其中存储值 0 或 1,但这不是实现 BOOL 类型的最佳方式.

I could create a column of INTEGER and store in it values 0 or 1, but it won't be the best way to implement BOOL type.

有办法吗?

推荐答案

SQLite 没有原生布尔数据类型.根据 数据类型文档:

There is no native boolean data type for SQLite. Per the Datatypes doc:

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

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

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

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