Copy link to clipboard
Copied
Hi All,
I am identifying whether a particular structure is a query object or not using isQuery(<some variable name>). If its a query object i need to find out the query object name . I tried getMetaData function but it didnt help . Can anyone help me how to identify the name of the query object.
Copy link to clipboard
Copied
Isn't it the value of your variable?
Copy link to clipboard
Copied
No not the value of the variable.
For ex:
<CFQUERY NAME="check">
....
I need to find the query object name. Like when i check for ifQuery(<object name>) , it should return the query object name. According to the example it should return "check"
Copy link to clipboard
Copied
Sounds like someone needs to read the cfml reference manual. I'll go first
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000529.htm
It is misleading isn't it. It doesn't say that the function will either return true or false, but that's what actually happens.
Copy link to clipboard
Copied
I am identifying whether a particular structure is a query object or not using isQuery(some_variable_name). If its a query object i need to find out the query object name.
As Dan suggested, some_variable_name.
Copy link to clipboard
Copied
Sorry i framed the question wrongly.
We are storing all complex objects in a structure and sending it to some other function.
Once the function recieves the structure as paramater , it loops through the structure and it will isolate the query objects(using the isquery function)
But for some debugging info i need to identify the query object names that was isolated during the isquery function.
Copy link to clipboard
Copied
And I think you are not understanding what everybody is telling you.
Whatever you pass to the isQuery() function parameter IS the name of the query record set object! There is no hidden name. If at one time the query record set was stored under a different variable name before it was passed into the complex structure you are examining has no relevance and stands a good chance of not even existing anymore.
Copy link to clipboard
Copied
Regarding "
Whatever you pass to the isQuery() function parameter IS the name of the query record set object! There is no hidden name. If at one time the query record set was stored under a different variable name before it was passed into the complex structure you are examining has no relevance and stands a good chance of not even existing anymore."
Try this.
theStruct = Strucnew();
<cfquery name="TheStruct.query1">
<cfloop collection="#thestruct#" item="abc">
<cfif isquery(abc)>
output whatever variable gives you "query1"
Copy link to clipboard
Copied
Now I'm starting to see the problem. You might have to do something like this:
<cfquery name = "abc">
select blah, blaugh, "abc" queryname
from etc
in all your queries.
Copy link to clipboard
Copied
Thank you all for answering this.
I was looking for something like getMetaData function which gives me some idea about the object.
Thank you Dan for giving me a workaround.