#1 2020-09-16 13:41:27

squirrel
Member
Registered: 2015-08-13
Posts: 155

Maximum number of parameters in MySql query

Is there a maximum number of parameters that can be passed to a query when using Firedac?

I am able to perform a big insert on Mysql when connected with TodbcConnectionProperties without issues, but when using Firedac (libmysql.dll), I get the following error:

{
"errorCode":500,
"error":
{"ESQLDBException":{
	"ClassName":"ESQLDBException",
	"Address":"a8fef1 SynDB.ReplaceParamsByNames (8038) ",
	"Message": "Parameters :AA to :ZZ"
}}
}

It is raised by ReplaceParamsByNames which does not seem to be called when using the odbc connection.  Am I correct?  If so, what is the maximum number of parameters that can be used in a query, or is this limited to a byte size and not a count?
Would it be possible for me to determine this limit in my code before running the query?

Offline

#2 2020-09-16 18:52:38

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Maximum number of parameters in MySql query

ReplaceParamsByNames can replace up to (Ord('Z')-Ord('A'))^2-19 = 606 parameters (19 is a length(SQL_KEYWORDS)-1)
In case of ODBC, statement is passed to ODBC driver with ?, so ReplaceParamsByNumbers not used.

In case of SynDBOracle/SynDBPostgres limitation is 999 (ReplaceParamsByNumbers used instead of ReplaceParamsByNames)

Last edited by mpv (2020-09-16 18:53:35)

Offline

#3 2020-09-17 05:55:58

squirrel
Member
Registered: 2015-08-13
Posts: 155

Re: Maximum number of parameters in MySql query

Thanks @mpv.  That is exactly the info I was looking for smile

Offline

Board footer

Powered by FluxBB