Another bug with queryExecute - Threads

This post is more than 2 years old.

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(&quot;id&quot;, &quot;varchar&quot;, [{id:&quot;a&quot;}, {id:&quot;b&quot;}]);

cfthread(name=&quot;d1&quot;) {
	thread.result = queryExecute(&quot;select * from data&quot;, {}, {dbtype:&quot;query&quot;});
cfthread(name=&quot;d2&quot;) {
	var result = queryExecute(&quot;select sleep(2), title from tblblogentries limit 0,1&quot;, {}, {datasource:&quot;myblog&quot;}); = 1;
	thread.result = result;


<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:

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA