Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.2k views
in Technique[技术] by (71.8m points)

sqlite 的字段长度有什么用?

创建一个表,一个字段长度为 1

CREATE TABLE "main"."aa" (
"t"  TEXT(1)
)
;

插入一个长度大于 1 的数据, 为什么会插入成功呢?
那么这个字段长度有什么用呢?

INSERT INTO "main"."aa" ("t") VALUES ('adadasdasdasdasdasdasdasdasdasdasdasda')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

没啥用,当成注释文档吧

Note that numeric arguments in parentheses that following the type name (ex: "VARCHAR(255)") are ignored by SQLite - SQLite does not impose any length restrictions (other than the large global SQLITE_MAX_LENGTH limit) on the length of strings, BLOBs or numeric values.

https://sqlite.org/datatype3....


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...