Rather than adding an additional argument to getData() perhaps we need to add something to setData() that refreshes that cache. What do people think?

-- geoff
http://www.daemon.com.au/

Scott wrote:

I have recently used FourQ as a DAO layer for a non-FarCry project.  An
odd issue has come up when updating business objects.  I create the
structure for the update, issue the myCfc.edit(st), and then do a
getData( st.id ).  The getData() always returns a cached copy of the
data, pre-update.

I have created a private version of the function allowing me to force a
db select (see below), but was wondering if there is something else
that I am missing.....

        <cffunction name="getData" access="public" output="false"
returntype="struct" hint="Get data for a specific objectid and return
as a structure, including array properties and typename.">
                <cfargument name="objectid" type="uuid" required="true">
                <cfargument name="dsn" type="string" required="false"
default="#application.dsn#">
                <cfargument name="dbowner" type="string" required="false"
default="#ucase(application.dbowner)#">
                <cfargument name="bShallow" type="boolean" required="false"
default="false" hint="Setting to true filters all longchar property
types from record.">
                <cfargument name="bFullArrayProps" type="boolean" 
required="false"
default="false" hint="Setting to true returns array properties as an
array of structs instead of an array of strings.">
                <cfargument name="bRefreshCache" type="boolean" required="false"
default="false" hint="Setting to true returns array properties as an
array of structs instead of an array of strings.">
                <cfset var stobj=structnew()>
                <cfset var tablename="">
                <cfset var aprops="">
                <cfset var sqlSelect="">
                <cfset var i=0>
                <cfset var qgetData="">
                <cfset var key="">
                <cfset var qArrayData="">
                <cfset var aTmp=arraynew(1)>
                <cfset var stArrayProp=structnew()>
                <cfset var col=0>
                <cfset var j=0>

                <cfif isdefined("instance.bgetdata") and instance.bgetdata eq
arguments.objectid AND NOT arguments.bRefreshCache>
                        <!--- get local instance cache --->
                        <cfset stObj = instance.stobj>
                        <cftrace type="information" category="coapi" 
var="stobj.typename"
text="getData() used instance cache.">
                <cfelse>
                        <!--- build a local instance cache --->
                        <cfinclude template="_fourq/getData.cfm">
                        <cfset instance.stobj = stobj>
                        <cfset instance.bgetData = arguments.objectid>
                        <cftrace type="information" category="coapi" 
var="stobj.typename"
text="getData() used database.">
                </cfif>
                
                <cfreturn stObj>
        </cffunction>


--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content 
filtering.
http://www.mailguard.com.au/mg


Reply via email to