sqlite中varchar数据类型的最大大小限制是多少?

时间:2022-11-22 16:56:08

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

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

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

谁能告诉我一些与此相关的信息?我在sqlite.org网站上搜索了他们给出的答案如下:

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

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

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的长度。你可以声明一个VARCHAR(10),SQLite很乐意让你输入500个字符。它将保持所有500个字符完整 - 它永远不会截断。

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

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

1 个解决方案

#1


28  

from http://www.sqlite.org/limits.html

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

Maximum length of a string or BLOB

字符串或BLOB的最大长度

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:

SQLite中字符串或BLOB中的最大字节数由预处理器宏SQLITE_MAX_LENGTH定义。此宏的默认值为10亿(十亿或1,000,000,000)。您可以使用命令行选项在编译时提高或降低此值,如下所示:

-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.

-DSQLITE_MAX_LENGTH = 123456789当前实现仅支持长度为231-1或2147483647的字符串或BLOB长度。而在此之前,某些内置函数(如hex())可能会失败。在安全敏感的应用程序中,最好不要尝试增加最大字符串和blob长度。实际上,如果可能的话,最好将最大字符串和blob长度降低到几百万的范围内。

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的INSERT和SELECT处理过程中,数据库中每行的完整内容被编码为单个BLOB。因此,SQLITE_MAX_LENGTH参数还确定一行中的最大字节数。

#1


28  

from http://www.sqlite.org/limits.html

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

Maximum length of a string or BLOB

字符串或BLOB的最大长度

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:

SQLite中字符串或BLOB中的最大字节数由预处理器宏SQLITE_MAX_LENGTH定义。此宏的默认值为10亿(十亿或1,000,000,000)。您可以使用命令行选项在编译时提高或降低此值,如下所示:

-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.

-DSQLITE_MAX_LENGTH = 123456789当前实现仅支持长度为231-1或2147483647的字符串或BLOB长度。而在此之前,某些内置函数(如hex())可能会失败。在安全敏感的应用程序中,最好不要尝试增加最大字符串和blob长度。实际上,如果可能的话,最好将最大字符串和blob长度降低到几百万的范围内。

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的INSERT和SELECT处理过程中,数据库中每行的完整内容被编码为单个BLOB。因此,SQLITE_MAX_LENGTH参数还确定一行中的最大字节数。