Last active
August 29, 2015 14:15
-
-
Save ryanguill/177f0c14d0ea1d3c2356 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
writedump(server.lucee.version); //4.5.1.004 | |
function noRecordsTest() { | |
var q = queryNew("columnA"); | |
//return no records | |
var qData = queryExecute("SELECT columnA FROM q", {}, {dbtype="query"}); | |
writedump(qData); //empty recordset | |
writedump(qData.recordcount); //0 | |
writedump(qData.columnA); //partial null support: empty string, "complete" null support: null | |
writedump(qData.columnA ?: 0) //partial null support: empty string, "complete" null support: null | |
writedump(isNull(qData.columnA)); //false | |
writedump(!isNull(qData.columnA) ? qData.columnA : 0); //partial null support: empty string, "complete" null support: null | |
} | |
function nullColumnTest() { | |
var q = queryNew("columnA"); | |
queryAddRow(q) | |
querySetCell(q, "columnA", javaCast("null", 0)); | |
//returns one record | |
var qData = queryExecute("SELECT columnA FROM q", {}, {dbtype="query"}); | |
writedump(qData); //one row in recordset | |
writedump(qData.recordcount); //1 | |
writedump(qData.columnA); //partial null support: empty string, "complete" null support: null | |
writedump(qData.columnA ?: 0) //partial null support: empty string, "complete" null support: null | |
writedump(isNull(qData.columnA)); //false | |
writedump(!isNull(qData.columnA) ? qData.columnA : 0); //partial null support: empty string, "complete" null support: null | |
} | |
noRecordsTest(); | |
nullColumnTest(); | |
</cfscript> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment