Dave,
Thanks for your help, your explanation cut my code down quite a bit!

// create instance of the macro dao object
objMacro = createObject("component","apps.watchdawg.com.WD_MacroDAO").init(client.dn);

// read the values       
updateMacro = objMacro.read(url.updateActive);

// update active to value passed
updateMacro.setActive(url.Active);

// update the the macro
objMacro.update(updateMacro);

On 3/21/06, Dave Shuck <[EMAIL PROTECTED]> wrote:
Ryan, basically you would instantiate your object using a read from the DAO.  Then with that bean that is returned, you would do a set on the particular field you want to change.  You can ignore the other fields, since they already hold the current state and doing a set on them would only overwrite what they are holding.  Then you would do an update using your DAO passing the instance of the bean. 

~d


On 3/21/06, Ryan Everhart <[EMAIL PROTECTED]> wrote:
Not sure if this is going to make much sense or not, so please feel free to ask further questions. 

I have three cfcs for my object

WD_Macro
WD_MacroDAO
WD_MacroGateway

Now as we all know we use the WD_MacroDAO cfc to run simple CRUD tasks on the object.  However I have one particular update task that I'm questioning where it should go, should I put it in the Gateway or should I use the update function already built in the DAO?

This is what I want to do I basicaly want to update an Active flag for a job, 1 = on, 0 = off.  Thats it just a simple update based on a user clicking on a link on apage.  Soooo should I make a new function for this update in the DAO or Gateway CFC, or should I simply use the update funcation already in the DAO?  That seems like a lot of work just to update one field, because you have to read and do all your sets, then do the update.


If I did it through the exiting update function in the DAO I think I'd have to do something like this.

<cfscript>
            //creates an instance of the macro bean object
            objMacro = createObject("component","apps.watchdawg.com.WD_MacroDAO").init(client.dn);
            //read the object for this ID
            qGetMacro = objMacro.read(url.getMacro);
           
            objMacro.setMacro_ID(qGetMacro.getMacro_ID()));
            objMacro.setMacroName(qGetMacro.getMacroName()));
            objMacro.setMacroTime(qGetMacro.getMacroTime()));
            objMacro.setMacroFile(qGetMacro.getMacroFile()));
            objMacro.setMacroExe(qGetMacro.getMacroExe());
            objMacro.setActive(url.setActive); // coming from the URL either 0 or 1
           
            // create instance of the macro dao object
            updateMacro = createObject("component","apps.watchdawg.com.WD_MacroDAO").init(client.dn);
           
            //update the macro
            addUpdateMacro.update(objMacro);
</cfscript>


anythoughts?

Ryan

--
Ryan Everhart
[EMAIL PROTECTED]




--
~Dave Shuck
[EMAIL PROTECTED]
www.daveshuck.com
www.worldwildweb.biz

_______________________________________________
Reply to DFWCFUG:
 [email protected]
Subscribe/Unsubscribe:
 http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
 www.HostMySite.com
  www.teksystems.com/





--
Ryan Everhart
[EMAIL PROTECTED]
_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.HostMySite.com 
  www.teksystems.com/

Reply via email to