Hi Tom,

This will kill you from a performance perspective - this is n+1 queries
where there are n-records in the original query. I don't fully get what
you're trying to do, but if you want all or the original records and then
additional records for any joins, I'd do a left outer join on the original
query (just to make sure the column names are all there). That will return
one record per record in the original query. I would then UNION that with an
inner join that would return 1 record per join case. I don't really get the
use case as I usually see just a single left outer join for adding extended
data, but whatever you want, this is definitely a SQL problem - not a
Reactor or CF one.

Best Wishes,
Peter

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Chiverton
Sent: Friday, June 30, 2006 6:20 AM
To: [email protected]
Subject: [Reactor for CF] Adding propeties to TOs


We have a table managed by Reactor, and all is well.

Now we want to add some columns to these TO that come from running a query, 
and maybe empty.
Basically doing a join and returning a few extra columns where the join 
succeeds, as well as all the 'unjoined' records (inner ? outer ? can never 
remember !).

What's the best way to do this in Reactor ? Listen for load() in the the TO
? 

What I'm trying to achieve is currently done as below, but it means having 
this code everywhere.


<cfloop query="qStates">
        <cfquery name="qClientMatter" datasource="#_getConfig().getDsn()#">

        select fef_client,fef_matter from fe_file
        where file_id=<cfqueryparam value="#qStates.file_id#" 
cfsqltype="cf_sql_numeric">
        </cfquery>
        <cfif qClientMatter.recordCount eq 1>
                <cfset
stClientMatter.client[qStates.currentRow]=qClientMatter.fef_client>
                <cfset
stClientMatter.matter[qStates.currentRow]=qClientMatter.fef_matter>
        </cfif>
</cfloop>
<cfset queryAddColumn(qStates,'client',stClientMatter.client) >
<cfset queryAddColumn(qStates,'matter',stClientMatter.matter) >

-- 
Tom Chiverton

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and
Wales under registered number OC307980 whose registered office address is at
St James's Court Brown Street Manchester M2 2JF.  A list of members is
available for inspection at the registered office. Any reference to a
partner in relation to Halliwells LLP means a member of Halliwells LLP.
Regulated by the Law Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may
be confidential or legally privileged.  If you are not the addressee you
must not read it and must not use any information contained in nor copy it
nor inform any person other than Halliwells LLP or the addressee of its
existence or contents.  If you have received this email in error please
delete it and notify Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.

We are pleased to announce that Halliwells LLP has been voted AIM Lawyer of
the Year at the 2005 Growth Company Awards



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- Reactor for ColdFusion Mailing List [email protected] Archives
at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --




-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to