Changeset 410

Show
Ignore:
Timestamp:
1/15/2007 10:00:55 PM (2 years ago)
Author:
dhughes
Message:

This commits some outstanding updates and also adds a useTransaction argument to delete and deleteAll on the iterator object.

Fixes #59

Location:
trunk
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/config/reactor.xml

    r303 r410  
    22        <config> 
    33                <project value="Scratch" /> 
    4                 <dsn value="scratchMysql5" /> 
    5                 <type value="mysql" /> 
     4                <dsn value="scratch" /> 
     5                <type value="mssql" /> 
    66                <mapping value="/reactorData" /> 
    7                 <mode value="always" /> 
     7                <mode value="production" /> 
    88                <!-- These config values are not required --> 
    99                <!-- <username value="" /> 
  • trunk/create distribution package.bat

    r303 r410  
    66svn export http://svn.reactorframework.com/reactor/trunk/reactor "C:\Inetpub\Reactor For ColdFusion\distribute\Reactor" --force 
    77svn export http://svn.reactorframework.com/reactor/trunk/ReactorSamples "C:\Inetpub\Reactor For ColdFusion\distribute\ReactorSamples" --force 
    8 svn export http://svn.reactorframework.com/reactor/trunk/Documentation "C:\Inetpub\Reactor For ColdFusion\distribute\Documentation" --force 
     8svn export http://svn.reactorframework.com/reactor/trunk/Documentation/Documentation/!SSL! "C:\Inetpub\Reactor For ColdFusion\distribute\Documentation" --force 
    99 
    1010echo Reactor Version Information > "C:\Inetpub\Reactor For ColdFusion\distribute\version.txt" 
  • trunk/reactor/iterator/iterator.cfc

    r408 r410  
    147147                <cfset var field = "" /> 
    148148                <cfset var To = "" /> 
     149                <cfset var useTransaction = true /> 
     150                <cfset var args = StructNew() /> 
     151                                 
     152                <!--- this is a bit of a hack to manage deleting in a manual transaction ---> 
     153                <cfif StructKeyExists(arguments, "useTransaction")> 
     154                        <cfset useTransaction = arguments.useTransaction /> 
     155                        <cfset structDelete(arguments, "useTransaction") /> 
     156                        <cfset fieldList = ListDeleteAt(fieldList, ListFind(fieldList, "useTransaction")) /> 
     157                </cfif> 
    149158                 
    150159                <cfif NOT StructCount(arguments)> 
     
    160169                        <cfif getLinked()> 
    161170                                <!--- this obeject is in a linked iterator.  we need to delete the object that acts as the midpoint between the parent and this object being deleted ---> 
    162                                 <cfset Record._getParent().delete() /> 
     171                                <cfset Record._getParent().delete(useTransaction=useTransaction) /> 
    163172                        <cfelse> 
    164173                                <!--- delete the record ---> 
    165                                 <cfset Record.delete() /> 
     174                                <cfset Record.delete(useTransaction=useTransaction) /> 
    166175                        </cfif> 
    167176 
     
    201210                                 
    202211                                <!--- this object is in a linked iterator.  we need to delete the object that acts as the midpoint between the parent and this object being deleted ---> 
    203                                 <cfset Record[1]._getParent().delete() /> 
     212                                <cfset Record[1]._getParent().delete(useTransaction=useTransaction) /> 
    204213                        <cfelse> 
    205214                                <!--- delete the record ---> 
    206                                 <cfset Record.delete() /> 
     215                                <cfset Record.delete(useTransaction=useTransaction) /> 
    207216                        </cfif> 
    208217 
     
    219228                                <cfloop from="1" to="#ArrayLen(indexArray)#" index="x"> 
    220229                                        <!--- delete the record ---> 
    221                                         <cfset delete(indexArray[x]) /> 
     230                                        <cfset args[1] = indexArray[x] /> 
     231                                        <cfset args["useTransaction"] = useTransaction /> 
     232                                 
     233                                        <cfset delete(argumentCollection=args) /> 
    222234                                </cfloop> 
    223235                        </cfif> 
     
    229241        <!--- deleteAll ---> 
    230242        <cffunction name="deleteAll" access="public" hint="I delete all elements in this iterator" output="false" returntype="void"> 
     243                <cfargument name="useTransaction" hint="I indicate if this save should be executed within a transaction." required="no" type="any" _type="boolean" default="true" /> 
    231244                <cfset var Array = getArray() /> 
    232245                <cfset var x = 0 /> 
     246                <cfset var args = StructNew() /> 
    233247 
    234248                <cfloop from="#ArrayLen(Array)#" to="1" index="x" step="-1"> 
    235                         <cfset delete(x) /> 
     249                        <cfset args[1] = x /> 
     250                        <cfset args["useTransaction"] = useTransaction /> 
     251                        <cfset delete(argumentCollection=args) /> 
    236252                </cfloop> 
    237253        </cffunction> 
  • trunk/testDb.cfm

    r303 r410  
     1 
    12<cfset reactorFactory = CreateObject("Component", "reactor.reactorFactory") /> 
    23<cfset reactorFactory.init("/config/reactor.xml") /> 
    34 
    4 <cfset record = reactorFactory.createRecord("test") /> 
    5 <cfdump var="#record#" /><cfabort> 
     5<cfset CustomerGateway = reactorFactory.createGateway("Customer") /> 
     6 
     7<cfset total = 0 /> 
     8<cfloop from="1" to="30" index="x"> 
     9        <cfset tick = getTickCount() /> 
     10        <cfset CustomerGateway.test() /> 
     11        <cfset total = total + (getTickCount()-tick) /> 
     12</cfloop> 
     13 
     14avg: <cfdump var="#total/30#" />