Question
cfqueryparam question
I started changing some of my queries to include the use of
the
<cfqueryparam> option, as shown below:
<!--- Check to make sure url.tid exists and that it is numeric --->
<cfif not structkeyexists(url,"tid") and not isnumeric(url.tid)>
<cflocation addtoken="no" url="../club_tournaments.cfm">
</cfif>
<cfquery name="Confirmed" datasource="SB">
select u_fName,
u_lName,e_foil,u_club,u_uuid,e_foil_rating,e_foil_year,tournevent.e_epee,e_epee_rating,e_epee_year,c_full_name
from tournfencer left outer join tournevent
on tournfencer.u_id=tournevent.e_id
left outer join tournclub
on tournfencer.u_club=tournclub.c_name
where e_tid=<cfqueryparam cfsqltype="cf_sql_integer" value="#url.tid#"
maxlength="3">
order by u_lName
</cfquery>
Now if I enter something longer than three integers in length (just as a
test), I get a error message that looks like:
The cause of this output exception was that:
coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data
2294 value exceeds MAXLENGTH setting 3..
Is there any way to make the error message look a little more pleasing
to the eye??
<cfqueryparam> option, as shown below:
<!--- Check to make sure url.tid exists and that it is numeric --->
<cfif not structkeyexists(url,"tid") and not isnumeric(url.tid)>
<cflocation addtoken="no" url="../club_tournaments.cfm">
</cfif>
<cfquery name="Confirmed" datasource="SB">
select u_fName,
u_lName,e_foil,u_club,u_uuid,e_foil_rating,e_foil_year,tournevent.e_epee,e_epee_rating,e_epee_year,c_full_name
from tournfencer left outer join tournevent
on tournfencer.u_id=tournevent.e_id
left outer join tournclub
on tournfencer.u_club=tournclub.c_name
where e_tid=<cfqueryparam cfsqltype="cf_sql_integer" value="#url.tid#"
maxlength="3">
order by u_lName
</cfquery>
Now if I enter something longer than three integers in length (just as a
test), I get a error message that looks like:
The cause of this output exception was that:
coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data
2294 value exceeds MAXLENGTH setting 3..
Is there any way to make the error message look a little more pleasing
to the eye??