Title:
Bug 85856:(Watson Migration Closure)As an avid user of <cfproc and <cfprocparam I am constantly faced with the amount of effort and code needed to deal with passing NULL values
| View in TrackerStatus/Resolution/Reason: To Fix//
Reporter/Name(from Bugbase): Rod stichbury / Rod stichbury (Rods1)
Created: 01/16/2011
Components: Language
Versions: 9.0.1
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Major / Unknown
Locale/System: English / Win All
Vote Count: 0
Problem:
As an avid user of <cfproc and <cfprocparam I am constantly faced with the amount of effort and code needed to deal with passing NULL values. I believe that this tag's null parameter was designed to handle this effectively, and it does to some extent, but not without requiring copious ugly code around each instance in order to use it.. I prefer to pass ALL parameters to the cffunction via a struct, ....<cfargument name="data" type="struct" .....and simply omit any struct.element that needs a null value and test for its existence like so.....<cfif isDefined("arguments.p_product_data.keywords")> <cfprocparam value="#arguments.p_product_data.keywords#" dbVarName="@keywords" CFSQLType="cf_sql_varchar" maxLength="1000" /><cfelse><cfprocparam null="yes" dbVarName="@keywords" CFSQLType="cf_sql_varchar" /></cfif>BUT what I REALLY want to be able to do IN ONE LINE of code is .....<cfprocparam null="#unDef('arguments.params.isActive')#" value="#application.noVar('arguments.obj.isActive',0)#" dbVarName="@isActive" CFSQLType="cf_sql_bit" />unDef, and noVar are both UDF's It appears impossible to test for existence of a struct elements name, after attempting to pass that name to a UDF or similar cffunction. This is the issue that throws the "complex obj referenced as tho a simple variable" There appears to be no way around this ! unDef - simply needs to return YES or NO depending on whether its input (being the NAME of an arguments.struct element) of the CFfunc.. Exists or Not.I dont like the idea of (nor should it be necessary to) define and setup a separate variable to set the NuLL status of every parm element. In the interests of creating code that flows and can be easily read, checked and tested, my ONE LINE wish would be a great help !
Method:
In the interests of producing clean, readable code this enhancement would be very helpful indeed.Many thanks Rod
Result:
Different attempts to achieve the result invariably end in something like this - " Complex object types cannot be converted to simple values."
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3043097
External Customer Info:
External Company:
External Customer Name: Rod stichbury
External Customer Email: 5CF31B13458A2ED8992015A8
External Test Config: 01/16/2011
Attachments:
Comments: