sqlite中的字符串存储大小 [英] String storage size in sqlite

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

问题描述

在使用了很多SQL ServerSQL 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屋!

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