Well, depends on what your data needs to be. Sometimes 0 is not the same
as "no answer given". If you're allowing NULL in that data column and NULL
means something different than 0, then you will want to *not* use
default="0".
Often in those cases, I do something like the following, where I set the
arg to 'string':
<cfargument name="app_user_id" type="string" required="no"
default="" />
And then in the db call, I can do this:
<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.app_user_id#"
null="#not isNumeric(arguments.app_user_id)#" />
Alternatively, you may want to see a particular value if the method got
none sent in, like a new ID:
<cfif not isNumeric(arguments.app_user_id)>
<cfset arguments.app_user_id = goGetNewID() />
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332583
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm