Copy link to clipboard
Copied
The error template reports "The cause of this output exception was that: coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data value 50 exceeds maxlength setting 2.."
The data comes a table where the field is longer than 2 but is trimmed before being assigned into an application variable and then put in a select-option element. On test system, foutputted len() of the variable and got 2.
The error happens on the real system but doesn't happen on the test system.
Hoping for permission to put same debug in real system.
What could cause this error?
Copy link to clipboard
Copied
Let's see the <cfquery> that's erroring...
--
Adam
Copy link to clipboard
Copied
The whole query is too much to put in here. Here is the line ,cncode =<cfqueryparam value="#cncode#" cfsqltype="CF_SQL_CHARACTER" maxlength="2">.
Works on test but not on real live.
Copy link to clipboard
Copied
Why not just wrap the query up in a try/catch, and mail yourself the exact details and what data's going in? Clearly it's longer than two, else it wouldn't throw an error. No reason speculating, the value could be anything.
Copy link to clipboard
Copied
CF_SQL_CHARACTER is not a valid value in that situation. You probably mean CF_SQL_CHAR.
See the full list here:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f6f.html
As to why it's working at all, that's a bit of mystery, but I'd fix that just in case you're seeing a vagary of bad code rather than anything else.
What you could be seeing is CF doing something odd with "50" when it converts it to an [unknown type], and because of its loose-typed-ness it ends up being "50.0" or something like that. It might be down to which JVM version you're running on your various servers as to how it's handled.
Use legit CFML code first and see if the problem goes away... if not, we can revisit...
--
Adam
Copy link to clipboard
Copied
Thanks to you both. Guessing the invalid type is causing it.
Looking at program and have CF_SQL_CHARs until cncode which has the invalid type.
Copy link to clipboard
Copied
As to why it's working at all, that's a bit of mystery
CF9 defaults to "char" when the type is invalid (possibly earlier versions too). So you could use cf_sql_foobar and it would just fall back to cf_sql_char anyway. Obviously you should stick with valid types or you lose some of the benefits ...