More "null" support wackiness. I have a database ...
# cfml-general
m
More "null" support wackiness. I have a database table with a nullable column: "photoUrl". I have the following code which does nothing:
<cfif !isNull(article.photoUrl)>...</cfif>
No matter what, that cfif statement always returns true. If I change it to:
<cfif article.photoUrl != null>...</cfif>
Lo and behold, it works as expected. Maybe I misunderstand the meaning of the isNull() function.
a
article
is a query here, yeah? and
photoUrl
is a column? I suspect
isNull(article.photoUrl)
is checking the column, not the value within the
currentRow
of the column. And I suspect this is because the way code using
isNull
is compiled needs to do some cheating so that it doesn't just get a
article.photoUrl is undefined
on the function call, before
isNull
even has a chance to run. And the internal workings of
isNull
don't respect that
article.photoUrl
can be shorthand for
article.photoUrl[article.currentRow]
. This is, however, a guess.
m
Yes, that is a query and column. I believe you are correct about isNull checking the column. I've had pretty good success in checking for null with == or !=. Thanks for the reply.