| Here's a thought... save() persists the whole record saveChanged() loops over an internal array, list, struct, whatever, that has the names of instance keys that have been changed since the last init/save operation... <cffunction name="setFoo" access="public" returntype="void" output="false"> <cfargument name="foo" type="string" required="true" /> <cfset variables.instance.foo = arguments.foo> <cfif not structKeyExists(variables.changedSinceInit,"foo")> <cfset variables.changedSinceInit.foo = true> </cfif> <cfif not structKeyExists(changedSinceSave,"foo")> <cfset variables.changedSinceSave.foo = true> </cfif> </cffunction> save() does: <cfset variables.changedSinceSaved = structNew()> and init() does: <cfset variables.changedSinceInit = structNew()> SaveChanged() then uses the keynames from changedSinceSaved to write to the DB. Save() works as per normal, saving the entire record. Obviously, the cfif operation to check the two internal structs would be encapsulated in other functions... the above cffunction snippet is just there to give the general idea of how this might work. Also note that the changedSince structs have nothing to do with the value of the keys... they're simply there to maintain a pointer to whether or not the data has changed since the last n operation. Any thoughts/feelings? Laterz, J ------------------------------------------------ Jared C. Rypka-Hauer Continuum Media Group LLC Member, Team Macromedia - ColdFusion "That which does not kill me makes me stranger." - Yonah Schmeidler |
- Reactor For CF Save Changed Fields (was Update Single ... Jared Rypka-Hauer
- RE: Reactor For CF Save Changed Fields (was Updat... Porter, Benjamin L.

