This is probably an old issue, but I thought I'd share it. I'm writing code to support exporting BlogCFC data into WDDX packets. The flip side of this is code to import the WDDX packets.
The export works just fine - but I ran into a weird issue when importing. I have some columns that are BIT type and allow nulls. When doing the database inserts, I got error saying it couldn't convert the bit value to a null.
Well, I figured - no big deal - I'll check to see if my value is boolean, and if not, I'll use null="true" in my cfqueryparam.
But get this - the CFIF threw an error! That was insane. How can I check if X is a boolean if the actual check throws 'X is not boolean' itself!
I ended up having to use try/catch to rewrite the data:
<cftry> <cfif not isBoolean(moderated)> <!--- nothing ---> </cfif> <cfcatch> <cfset querySetCell(data, "moderated", "", currentRow)> </cfcatch> </cftry>
Then I do this in my query:
<cfif not isBoolean(moderated)> <cfqueryparam cfsqltype="cf_sql_bit" null="true"> <cfelse> <cfqueryparam cfsqltype="cf_sql_bit" value="#moderated#"> </cfif>
For a simple test script (and this is what I'll provide to Adobe), create a table with two columns, name and cool, where cool is a bit. Then insert a few rows and make cool null for one row. Then run this:
<cfquery name="getit" datasource="test"> select * from test </cfquery>
<cfwddx action="cfml2wddx" input="#getit#" output="packet">
<cfwddx action="wddx2cfml" input="#packet#" output="gigo">
<cfoutput query="gigo"> #name# <cfif isBoolean(cool)> #yesnoformat(cool)# </cfif> <br> </cfoutput>
You will then get:
cannot convert the value "''" to a boolean
As a side note - it also appears to apply to ints as well. I wonder if it is an issue with any non-varchar column?