开发者

How should I use maxlength in CFQUERYPARAM list="true"?

开发者 https://www.devze.com 2023-03-27 12:55 出处:网络
I\'m curious how the maxlength attribute works in CFQUERYPARAM when you are passing a list. Does the maxlength apply to the len开发者_运维知识库gth of the entire list (i.e. length of \"1,2,3,4,5,6\" =

I'm curious how the maxlength attribute works in CFQUERYPARAM when you are passing a list. Does the maxlength apply to the len开发者_运维知识库gth of the entire list (i.e. length of "1,2,3,4,5,6" = 11)? Or does the maxlength apply to each item in the list?

I cannot find any documentation of this.


I found the answer, and it's what I expected and wanted. Maxlength applies to each item in a list, so the following works:

<cfqueryparam list="true" value="1,2,3,4,5,6" maxlength="1" />

whereas, the following throws an exception:

<cfqueryparam list="true" value="1,2,3,4,5,26" maxlength="1" />

Exception:

"The cause of this output exception was that: coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data value 26 exceeds maxlength setting 1.. "

0

精彩评论

暂无评论...
验证码 换一张
取 消