sqlite中varchar数据类型的最大大小限制是多少? [英] What is the maximum size limit of varchar data type in sqlite?

查看:350
本文介绍了sqlite中varchar数据类型的最大大小限制是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 sqlite 的新手.我想知道sqlite中varchar数据类型的最大大小限制?

I'm new to sqlite. I want to know the maximum size limit of varchar data type in sqlite?

有人可以向我推荐一些与此相关的信息吗?我在 sqlite.org 网站上搜索,他们 给出答案:

can anybody suggest me some information related to this? I searched on sqlite.org site and they give the answer as:

问.SQLite 中 VARCHAR 的最大大小是多少?

Q. What is the maximum size of a VARCHAR in SQLite?

A. SQLite 不强制 VARCHAR 的长度.你可以声明一个 VARCHAR(10) 并且 SQLite 很乐意让你把 500其中的字符.它将保持所有 500 个字符完好无损 - 它从不截断.

A. SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to let you put 500 characters in it. And it will keep all 500 characters intact - it never truncates.

但我想知道 sqlite 中 varchar 数据类型的确切最大大小限制.

but I want to know the exact max size limit of varchar datatype in sqlite.

推荐答案

来自 http://www.sqlite.org/limits.html

字符串或BLOB的最大长度

Maximum length of a string or BLOB

最大字节数SQLite 中的字符串或 BLOB 定义为预处理器宏SQLITE_MAX_LENGTH.这个宏的默认值是10亿(1000百万或 1,000,000,000).你可以提高或降低此值使用命令行编译时像这样的选项:

The maximum number of bytes in a string or BLOB in SQLite is defined by the preprocessor macro SQLITE_MAX_LENGTH. The default value of this macro is 1 billion (1 thousand million or 1,000,000,000). You can raise or lower this value at compile-time using a command-line option like this:

-DSQLITE_MAX_LENGTH=123456789 目前的实现只会支持字符串或 BLOB 长度可达231-1 或 2147483647.还有一些内置的hex() 等函数可能会失败在那之前.在对安全敏感的应用程序最好不要试图增加最大字符串和 blob 长度.在事实上,你可以很好地降低最大字符串和 blob 长度为在几个范围内的更多东西如果可能的话,百万.

-DSQLITE_MAX_LENGTH=123456789 The current implementation will only support a string or BLOB length up to 231-1 or 2147483647. And some built-in functions such as hex() might fail well before that point. In security-sensitive applications it is best not to try to increase the maximum string and blob length. In fact, you might do well to lower the maximum string and blob length to something more in the range of a few million if that is possible.

在 SQLite 的部分 INSERT 和SELECT处理,完成数据库中每一行的内容是编码为单个 BLOB.所以SQLITE_MAX_LENGTH 参数也确定最大字节数连续.

During part of SQLite's INSERT and SELECT processing, the complete content of each row in the database is encoded as a single BLOB. So the SQLITE_MAX_LENGTH parameter also determines the maximum number of bytes in a row.

这篇关于sqlite中varchar数据类型的最大大小限制是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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