isQuery fails when its a storedproc called in cfqu...
# cfml-beginners
g
isQuery fails when its a storedproc called in cfquery or cfstoredproc, is there a udf or a java method which can detect its a query?
b
This makes no sense. Please post code.
g
Isquery(qrsresults) ‘<cfquery name=‘qrsresults’>exec do.getusers</cfquery>’
Isquery checks giving me no
b
Dump it out, is it a query? I'm guessing not since you're not selecting a result set out.
Copy code
<cfdump var="#qrsresults#">
@gsr ☝️ What does that outpout?
g
it output query, but when i do a isQuery around it, it says NO
m
"around it" - please show all code
g
Copy code
<cfdump var="#Isquery(qrsresults)#"> - it says NO
Copy code
<cfquery name='qrsresults'>exec do.getusers</cfquery>
m
are you dumping before you run the query?
Copy code
<cfquery name='qrsresults'>
  exec do.getusers
</cfquery>

<cfdump var="#qrsresults#">

<cfdump var="#IsQuery(qrsresults)#">
should exec the SP, then show the results, then show yes/no.
b
Can you screen shot the dump output for us?
g
ok
Now i am getting confused, so i did some more debugging and found that isQuery is returning YES but ots not logging the sql which i need here is my code for that
Copy code
<cfloop collection="#variables#" item="boxes.i">
	<cftry>
		<cfif not listfindnocase(boxes.ignoreVariables,boxes.i)>
			<cfif IsQuery(variables[boxes.i])>
				<cfif val(boxes.QueryRecNum)>
					<cfquery name="boxesBox.query.variables.#boxes.i#" dbtype="query" maxrows="#boxes.QueryRecNum#">
						select * from #boxes.i#
					</cfquery>
				<cfelse>
					<cfset SetVariable("boxesBox.query.variables.#boxes.i#",variables[boxes.i])>				
				</cfif>
				<cfset SetVariable("boxesBox.vari.#boxes.i#",'[Query]')>
			<cfelse>
				<cfset SetVariable("boxesBox.vari.#boxes.i#",variables[boxes.i])>
			</cfif>
		</cfif>
		<cfcatch><cflog file="Error_Logs" application="no" text="#cfcatch.detail# - #cfcatch.message#"></cfcatch>
	</cftry>
	</cfloop>
b
☝️ That code is not calling a stored proc inside a cfquery. It's just running a query of query. Totally different thing
g
is that why the problem is?
b
I have no idea what your problem is, lol. All I know is you asked a specific question about calling a stored proc in a cfquery tag (which I wouldn't expect to work at all like you expected) and when asked to post the code, you posted something totally unrelated.
My ability to help you with your original question is limited by your ability to post the related code to your question.
g
well, anyways no issues i willfigure out what is going on
s
I think results from a cfquery is a struct
the query is in it though
with stored procedures a hacky one would be !isSimpleValue()
@bdw429s a qoq still returns a query though doesn't it?
b
Yes
So far as I know the
name
from cfquery will ALWAYS return a query (unless the query was an update or delete or something with no result sets). The
result
attribute is probably what you're thinking of that has other metadata mixed in with it.
s
Yes - I think result is a struct and name is the query that was executed
less clear about a qoq though I've never used result with that
b
It's no different in regards to the output of the tag
s
good to know
b
No different than hitting a DB, that is
s
the limits for qoq do frustrate me sometimes as otherwise it's very handy
b
I just finished another large refactor of Lucee's QoQ actually
Sent the pull yesterday and planning to blog about it today
Lucee QoQ is now over twice as fast, tested up to 1 million rows
s
Nice! If you could ping me when you put it up I'd be interested in reading it
👍 1
b
And it blows the pants off Adobe's QoQ 🙂
I'm using parallel java streams for concurrent processing now
If there are any particular QoQ limits that annoy you, let me know. I have a lot of additional stuff I'd like to add including native JOIN support that doesn't use HSQLDB
s
I use them less than I used to. Tend to offload what I'd do previously to the db
Also the ingrained idea that they were clunky before
and lack of keywords that you can use in a normal cfquery
if I'm honest a lot of what I'd have done before in a qoq I use filter() for now
b
Lucee QoQ already support way more keywords and functions than Adobe ever did
Here's a sneak peak comparison at how much better Lucee QoQ's perform over Adobe 2021
message has been deleted
s
hah!
b
The wheels fall off Adobe after around 200K rows
s
well I don't even have any 2021 servers at the moment so...:)
Have quite a few legacy codebases littered with qoq which is why on the newer ones I try to avoid it
from that graph though it looks like it'd be much more appealing to use it over offloading to the db
back to the topic at hand... @gsr can you post the code you're having issues with
g
@salted here
Copy code
<cfloop collection="#variables#" item="boxes.i">
 <cftry>
  <cfif not listfindnocase(boxes.ignoreVariables,boxes.i)>
   <cfif IsQuery(variables[boxes.i])>
    <cfif val(boxes.QueryRecNum)>
     <cfquery name="boxesBox.query.variables.#boxes.i#" dbtype="query" maxrows="#boxes.QueryRecNum#">
      select * from #boxes.i#
     </cfquery>
    <cfelse>
     <cfset SetVariable("boxesBox.query.variables.#boxes.i#",variables[boxes.i])>    
    </cfif>
    <cfset SetVariable("boxesBox.vari.#boxes.i#",'[Query]')>
   <cfelse>
    <cfset SetVariable("boxesBox.vari.#boxes.i#",variables[boxes.i])>
   </cfif>
  </cfif>
  <cfcatch><cflog file="Error_Logs" application="no" text="#cfcatch.detail# - #cfcatch.message#"></cfcatch>
 </cftry>
 </cfloop>
now i double checked this value is <cfif val(boxes.QueryRecNum)> is falseo, so no QoQ, but the below code does not give me the sql of the needed query
b
@gsr You were asked to show • the actual query producing the variable • a dump of the variable Your code above does not help because no one here can guess where
variables[boxes.i]
came from or how it was created