Cfquery: name and result

(Unsure if dev, dev-support or language…)

After the feedback about the “slow” OOO implementation of Query(), I had a deeper look at cfquery().

The function has 2 parameters, name and result. From my point of view, name is for attributes and result has the result of the query.

<cfscript>
cfquery(datasource="test", name="qInsert", result="qInsertResult", sql="INSERT INTO test (foobar) VALUES ('#createUUID()#')");
writeDump(structKeyExists(variables, "qInsert")); // false
writeDump(structKeyExists(variables, "qInsertResult")); // true
writeDump(qInsertResult);

CleanShot 2025-09-01 at 15.12.02

cfquery(datasource="test", name="qSelect", result="qSelectResult", sql="SELECT * FROM test");
writeDump(structKeyExists(variables, "qSelect"));
writeDump(qSelect);

CleanShot 2025-09-01 at 15.12.29@2x

writeDump(structKeyExists(variables, "qSelectResult"));
writeDump(qSelectResult);

CleanShot 2025-09-01 at 15.12.47

</cfscript>

Insert: Name doesn’t exist
Insert: Result shows the meta-data for the query

Select: Name shows the result of the query
Select: Result shows the meta-data for the query

(For reference:
Update: Name doesn’t exist
Update: Result shows the meta-data for the query)

Am I missing some kind of system or pattern here?

insert and update don’t produce result sets?

Quote: From my point of view, name is for attributes and result has the result of the query.

Well, I was refactoring the code, and replaced a function with cfquery. I was confused, that I can set the attribute name, but not access it (for update or insert). That the attribute result has not the actual result, but only meta-data and that the name attribute for SELECT has the actual result.

I excepted, that all queries have a name attribute (e.g. cache, query runtime, maybe created keys or so) and the SELECT has a result to use the result of the query.

Leaving the attribute naming aside and the historical nature (tech debt) of cfquery, the logical separation is pretty clear?