Peter,

 

I use a “homemade” DAO/Record generator that creates an update function that optionally accepts a structure that contains the fields I want updated.  Here is an example:

 

            <cffunction name="update" access="public" output="false" returntype="void" description="CRUD Update function for DAO">

                        <cfargument name="columnStruct" required="no" type="struct" default="#structNew()#">

                        <cfquery name='Security_ObjectDAOUpdate' datasource='#getDatasource().getDSN()#'>

                                    <cfset prev = 0>

                                    UPDATE           ANSWEB.dbo.Security_Object

                                    SET     

                                                <cfif structIsEmpty(columnStruct) OR structKeyExists(columnStruct,'objectName')><cfif prev>,</cfif><cfset prev=1>objectName=<cfQueryParam cfsqltype="CF_SQL_VARCHAR" value="#SecurityObject.getobjectName()#"></cfif>

                                                <cfif structIsEmpty(columnStruct) OR structKeyExists(columnStruct,'objectDesc')><cfif prev>,</cfif><cfset prev=1>objectDesc=<cfQueryParam cfsqltype="CF_SQL_VARCHAR" value="#SecurityObject.getobjectDesc()#"></cfif>

                                    WHERE

                        </cfquery>

            </cffunction>

 

 

Not the best solution, but it works for now. 

Hope that answers your question.

 

Regards,

Chris

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter J. Farrell
Sent: Wednesday, February 22, 2006 3:32 PM
To: [email protected]
Subject: Re: [Reactor For CF] "Selective Updates" (was Mapping Issue)

 

Chris Terrebonne said the following on 2/22/2006 3:17 PM:

Peter,

 

I dabbled in FB, but currently use MG.  Why do you ask?

 

Chris

 

I'm just curious how you would do an update using MG (or Mach-II since the process would be the same in general implementation) using selective updates without Reactor?  Meaning having your "app updating columns that I haven’t explicitly requested it to".  I'm assuming your using some type of Bean/Business/Value Object at least in my head. 


-- 
Peter J. Farrell :: Maestro Publishing
Member Team Mach-II :: Member Team Fusion
http://blog.maestropublishing.com
 
Create boilerplate beans and transfer objects for ColdFusion!
Fire up a cup of Rooibos!
http://rooibos.maestropublishing.com/
 

-- 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