Wow, not a good morning for one of my favorite new features of ColdFusion 11. This morning I reported on a bug found with queryExecute by a user on StackOverflow. I did some more digging and found that if you use queryExecute inside a thread, it returns an undefined value. Here is a simple test case:


data = querynew("id", "varchar", [{id:"a"}, {id:"b"}]);

cfthread(name="d1") { thread.result = queryExecute("select * from data", {}, {dbtype:"query"}); } cfthread(name="d2") { var result = queryExecute("select sleep(2), title from tblblogentries limit 0,1", {}, {datasource:"myblog"}); = 1; thread.result = result; } cfthread(action="join",name="d1,d2"); writedump(cfthread); </cfscript>

<cfdump var="#variables#" showudfs="false" >

In the code above I'm running two threads that use queryExecute. In the first thread the value of result is undefined. In the second thread it throws an error because result is not defined.

So, you can't use queryExecute inside a thread call. I've reported this here: