add support for NULL="AUTO" on CFQUERYPARAM
It’s a been a year, no further votes or discussion on this and see Sean Corfield’s response.
7 comments
-
I agree with Adrian that this is too tied to your application's data and is not an appropriate feature for the language or for Railo (and if we add it, code that uses it won't run on other CFML engines!). I'll leave this suggestion open for a while longer but my inclination is to decline it.
-
Randy Merrill
commented
A zero length string... is a zero length string, not a null.
-
zac.spitzer
commented
really simple oracle style, a zero length string is null
-
Adrian Lynch
commented
Exactly. Unless I'm completely missing something here, auto doen't seem like it would be anything special. Leave it to us to decide when to pass a NULL.
-
Randy Merrill
commented
Couldn't you also do: <cfqueryparam value="#arguments.ServiceName#" cfsqltype="cf_sql_varchar" null="#len(arguments.ServiceName)#"> or <cfqueryparam value="#arguments.ServiceName#" cfsqltype="cf_sql_varchar" null="#len(arguments.ServiceName) EQ 0#">
-
Adrian Lynch
commented
But what would cause NULL to be used? An empty string for character types? A zero for numeric types? This is too tied into your application's data, null="yes|no" is the way to go for this I feel.
-
Sundvor
commented
I fully support this idea as the IIF statements are adding a lot of noise to my code. E.g.
ServiceName = <cfqueryparam value="#arguments.ServiceName#" cfsqltype="cf_sql_varchar" null="#iif(len(arguments.ServiceName),de('NO'),de('YES'))#">
should really just have to be :
ServiceName = <cfqueryparam value="#arguments.ServiceName#" cfsqltype="cf_sql_varchar" null="auto">