One of the annoying things in CF is that when you query a database, all NULL values in the db actually come back as empty strings. This means that if you actually store an empty string in the database, you have no way of knowing if it was an empty string, or a NULL value.
I hit this the other day when working on a database column where both an empty string and NULL values where valid data values, and had very different meanings.
That's when the light turned on, and I realized 'duh! CF is Java, so if the DB value is NULL, the Java call will return NULL, which we can check for'.
So, knowing that (a) a cfquery resultset is actually a java.sql.ResultSet, and (b) that a cfoutput / cfloop call only iterates through the result set, I can can run .getString(columnName) on it, and if the value it returns is NULL, it will return a Java null value.
So what I ended up with was the following isNull() function, that works a treat, and can tell when a real NULL value is returned, not just an empty string:
<cfquery datasource="db" name="query">
select * from table
#columnName# : #isNull(query, "columnName")#
<cffunction name="isNull" hint="is this null" access="public" returntype="boolean" output="false">
<cfargument name="query" hint="the current query" type="query" required="Yes">
<cfargument name="column" hint="Column Name" type="string" required="Yes">
var value = arguments.query.getString(arguments.column);