mithlond
04/15/2022, 3:54 PMnull
values? I'm doing code like
querysim("col1,col2,col3
foo | | bar")
cfvonner
04/15/2022, 4:00 PMqueryNew()
and building an actual query from an array of structs.mithlond
04/15/2022, 4:01 PMcfvonner
04/15/2022, 4:01 PMScott Steinbeck
04/15/2022, 4:03 PMmithlond
04/15/2022, 4:05 PMScott Steinbeck
04/15/2022, 4:10 PMScott Steinbeck
04/15/2022, 4:17 PM[empty string]
in place of a null
whether its from the database or created in a queryNew
function.
Just for clarity querySim
is just a decorator/wrapper around queryNew
to simplify creating a query object.
https://github.com/Ortus-Solutions/TestBox/blob/059d40989d84428b673e688779be6fc428f3987c/system/MockBox.cfc#L821-L839mithlond
04/15/2022, 4:21 PMScott Steinbeck
04/15/2022, 4:24 PMScott Steinbeck
04/15/2022, 4:25 PM<cfscript>
news = queryNew([
{"id":1,"title":"Dewey defeats Truman"},
{"id":2,"title":javacast('null','')}
]);
filterNoNulls = queryExecute("select * from news where title is null",{},{dbtype="query"})
writeDump(filterNoNulls);
</cfscript>
mithlond
04/15/2022, 4:26 PMScott Steinbeck
04/15/2022, 4:26 PMnull
values (you can do it like i showed above)
the query object will print
empty strings when looping over itmithlond
04/15/2022, 4:26 PMis null
for = ''
it returns no rows 😬mithlond
04/15/2022, 4:26 PMmithlond
04/15/2022, 4:27 PMScott Steinbeck
04/15/2022, 4:27 PMmithlond
04/15/2022, 4:27 PMmithlond
04/15/2022, 4:27 PMScott Steinbeck
04/15/2022, 4:27 PMjavacast('null','')
. without enablenullsupport
you cannot just call null
in cf2018. Lucee does have a function nullvalue()
that will create a null valuemithlond
04/15/2022, 4:28 PMmithlond
04/15/2022, 4:29 PMbockensm
04/15/2022, 6:07 PMbockensm
04/15/2022, 6:08 PMScott Steinbeck
04/15/2022, 6:09 PMfunction null(){
return;
}