Monday, September 5, 2011

Easy method for setting cfqueryparam null attribute

One function I'm surprised that wasn't built-in to ColdFusion until CF9 is isNull(). Since my company is currently on CF8, I decided to create my own function.  This was useful for me when trying to set the boolean value in cfqueryparam's null attribute.

One solution would be to set a local flag by evaluating len(trim(myvar)), but I thought calling a cfc made more sense, and it is still pretty straightforward.

Feel free to use this code in your non-CF9 applications. I only developed this for use with simple strings, so use with caution. I have now updated the code to handle strings, structs, arrays, and queries. I have not tested nested structures yet. Has anyone used CF9's isNull() function for more complex structures?

Tuesday, August 23, 2011

ColdFusion query of queries divide by zero not throwing error

Interesting discovery I made today:  If you divide by zero in a ColdFusion query of queries, you don’t get an error.  When you dump the result of the query of queries it shows a special character symbol.  I would have expected to get an error.  Has this been / should this be reported to Adobe as a bug?