每个数据库提供程序类型允许的最大参数数量是多少

每个数据库提供程序类型允许的最大参数数量是多少

本文介绍了每个数据库提供程序类型允许的最大参数数量是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以通过ADO.Net传递到Sql Server查询的参数限制为2,100,但是.Net开发人员使用的其他常见数据库的记录限制是什么-特别是我感兴趣的是:

There is a limit of 2,100 parameters which can be passed to a Sql Server query i.e. via ADO.Net, but what are the documented limits for other common databases used by .Net developers - in particular I'm interested in:

  • Oracle 10g/11g
  • MySql
  • PostgreSql
  • Sqlite

有人知道吗?

推荐答案

Oracle:64,000. 来源

Oracle: 64,000. Source

MySQL:

  • 默认情况下没有限制. MySQL的文本协议"要求.NET客户端库在将命令文本发送到服务器之前,替换所有参数.没有可以强制执行的服务器端限制,并且客户端没有限制(可用内存除外).
  • 如果通过调用MySqlCommand.Prepare()(并在连接字符串中指定IgnorePrepare=false)使用"prepared statement",则限制为65,535个参数(因为num_params必须适合两个字节).
  • By default, there is no limit. The MySQL "text protocol" requires that the .NET client library substitute all parameters before sending the command text to the server; there is no server-side limit that can be enforced, and the client has no limit (other than available memory).
  • If using "prepared statements" by calling MySqlCommand.Prepare() (and specifying IgnorePrepare=false in the connection string), then there is a limit of 65,535 parameters (because num_params has to fit in two bytes).

PostgreSql:按照Magnus Hagander的回答,查询为34464,函数为100(答案在此处复制以提供单个参考点)

PostgreSql: 34464 for a query and 100 for a function as per Magnus Hagander's answer (Answer copied here to provide a single point of reference)

SqlLite:999(SQLITE_MAX_VARIABLE_NUMBER,默认为999,但可以在运行时降低)-对于函数,默认值为100参数. 请参阅运行时限制文档的第9节

SqlLite: 999 (SQLITE_MAX_VARIABLE_NUMBER, which defaults to 999, but can be lowered at runtime) - And for functions default is 100 parameters. See section 9 Of Run-time limits documentation

这篇关于每个数据库提供程序类型允许的最大参数数量是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:45