sqlite中的字符串存储大小 [英] String storage size in sqlite
问题描述
在使用了很多SQL Server
和SQL Server Compact
之后,我最近开始使用Sqlite
.我目前正在 Sqlite 中创建表,并注意到在定义字符串列时似乎不需要输入字符串长度限制.在 SQL Server
中定义了一个 255 个字符的字符串数据类型,如:varchar(255)
.在 SQL Server Compact
中,它的定义如下:nvarchar(255)
.
After using lots of SQL Server
and SQL Server Compact
, I have recently started to use Sqlite
. I'm currently creating tables in Sqlite and have noticed that there doesn't seem to be any need to input the string length limit when defining string columns. In SQL Server
a 255-character string datatype is defined like: varchar(255)
. In SQL Server Compact
it is defined like: nvarchar(255)
.
然而,在Sqlite
中,列数据类型似乎可以简单地定义为text
,而无需输入任何大小限制.有没有办法在sqlite中定义大小限制?或者这甚至没有必要?
However, in Sqlite
, it appears that the column datatype can be defined simply as text
, without inputting any size limit. Is there a way to define a size limit in sqlite? Or is this not even necessary?
推荐答案
SQLite 中存在可管理的字符串或 blob 限制.默认值为 10^9 字节.查看文档顺便说一句,您无论如何都不需要在列声明中指定它.
There is a managable string or blob limit in SQLite. The default is 10^9 bytes. See documentation BTW you don't need to specify it on column declaration anyway.
这篇关于sqlite中的字符串存储大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!