This issue started at the moment I start using WireBox instedad of the
old modelMappings.cfm
I have to different queries, which If a CFDUMP both of them, the data
is there as it should.
When I do the "doInnerJoin" from the QueryHelper, the CFDUMP returns
something like:
Query
Execution Time (ms):0
Recordcount:5
Cached:No
Five records found, but the query cells are empty, NO DATA...
What happens when you take the generated sql and run it in the DB itself? I
am guessing that you are getting no records due to the way the relationships
are setup, but without seeing any code it is a best guess to say the least.
Ok, the only thing that I can think of here is that the query is being
pulled from a cached copy. WireBox should only affect anything that is going
to be wired in, so if this is the case here then I am thinking that you
haven't configured wireBox correctly. Have you double checked the settings
to switch this on.
And how is it being injected is this a singleton object, that maybe being
cached on its queries as well?
I suppose you haven't tried pulling the queryHelp plugin out and just using
normal straight CFQuery instead? Trust me that would execute 1000 times
faster than this method. Especially under load.
If my name was Scott my last name would be Andrews not Andrew, and in the
English speaking world the first name is always listed first unless
separated by a comma.
Honestly haven't used the QueryHelper, but I can only suspect what might be
the case. And I suspect that it is being cached by a previous query, or it
might be getting quashed because you have this in a singleton, unlikely if
you have var scoped but still something to double check.
But I am suspecting that as each query works on its own, then when you are
combing them the join might not be being created in the right way that you
expect the data, you need to remember that the join dictates as to which
direction the data will be retrieved from, and or return none if there is no
matching relationship if the join is not setup correctly either.
So let's look at it this way, I could write the query to return all parent
and any or none children. Or it could be written to retrieve all children
that have matching parents, or it could be told to return nothing if no
children exist. And this all depends on the type of join you are creating as
well.
If you are using ColdFusion Builder than I personally would be more inclined
to run the debugger over this section, and see if the query is being built
up the way you expect it to be built up. The fact that you stated that you
took the generated query and actually ran that in the DB and works might
suggest something more than meets the eye as well.
Not only this but you can see at a snapshot what all variables are in all
scopes as you go, I find this method of debugging much more successful in
troubleshooting code than just dumping data and re-run the application,
remove that and try something else, by the time you did this each time with
the dump you may have spotted the problem much quicker if you can actually
see what the system is doing at that break point, something you can not do
with a cfdump of information, because it is not telling you which line or
where this problem actually is happening, where a step over each line will
tell you exactly where this problem is, because it might be as simple as
something trashing the variables without you realising it.
Yeah that might be exaggeration on my part to be 1000 times faster, but
think about it this way. You are writing a script to generate a query that
should take at most depending on records, but let's say 3000 records that
should take around 0-10ms. Your code might take 30ms just to generate the
query, and then another 10ms to run the query. That is an extra 30ms that
could very easily be avoided, if the need ever arises.
Please don't assume that I am saying you should ditch the idea, because you
might be working on a low volume site and never experience anything more
there.