queryExecute bughunt
# lucee
d
queryExecute bughunt
Copy code
// if buggy=true, lucee returns nothing from the query
function foo( required boolean buggy ) {
	var q = queryExecute("
		declare @foo table(x int);
		insert into @foo (x) values (42)
		select * from @foo;
	", {}, buggy ? {result: "local.result"} : {});
	writedump(local);
}

foo( buggy = true );
b
I didn't realize queryexecute() supported a result via the query options
I always just thought you got the query back as a return from the BIF
I assume the
q
variable has the correct query in both cases?
d
no q is empty too
😢 1
Well, Lucee's docs do claim that
Copy code
All the <cfquery> tag attributes are supported, except the name attribute.
as the
options
struct.
d
I guess something about multiple statements, because the following is fine
Copy code
var q = queryExecute("
	select * from (select 1 x) x;
", {}, buggy ? {result: "local.result"} : {});
👍 1
b
Yes, perhaps specifying a result changes the code path internally and affects how it processes multiple results
d
not identical but probably related to https://luceeserver.atlassian.net/browse/LDEV-4140
j
Is this on mssql? We've had something similar when we switched from the jTDS driver (where it worked) to the one provided by Microsoft (where it didn't work). We've reworked out code around that, but I remember back then I had a hunch that it could be the way MS was handling the execution for what it thought was an INSERT only statement (ExecuteNonQuery) vs a data retrieval query (ExecuteScalar, ExecuteReader)
d