In ColdFusion 9, what isNull() and what is it good for
ColdFusion 9ColdFusion 9 brings us a new function called isNull. But, you may say ColdFusion doesn't support null's and you would still be mostly right. As of ColdFusion 9 certain objects can be null. Sound tricky? Here are a couple handy uses for isNull.
Working with caches
When using CacheGet if the id you pass does not exist then the returned object will be null. Its therefore best to check after getting the data:
When using either entityLoad with unique=true or entityLoadByPK which is required to change values of an existing object (in db terms: a row you want to do an update on) if the id you pass in does not return an object then you get a null object back.
Checking to see if a variable exists
While not an object its possible to check for an undefined variable with isNull. (Queue debate on which is quicker/better for determining if a variable exists isNull, isDefined or structKeyExists!)
isNull is a minor addition but one that proves quite useful when working with caching and/or ORM.






Loading....