Actually that's not strictly true.  There is no need to lock only for
certain conditions. Race conditions still apply.

Russ

> -----Original Message-----
> From: Robertson-Ravo, Neil (RX) 
> [mailto:[EMAIL PROTECTED] 
> Sent: 03 August 2004 14:38
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] Comments!
> 
> If you are on MX you don't *need* to lock these vars...it is 
> still good practice but you don't need to..
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 03 August 2004 14:30
> To: [EMAIL PROTECTED]
> Subject: Re: [ cf-dev ] Comments!
> 
> 
> <cfif #file.filewassaved# eq "yes">
> can be rewritten to
> <cfif file.filewassaved eq "yes">
>  [or even <cfif file.filewassaved> !]
> 
> likewise
> <cfset bigpic = '#trim(file.serverfile)#'>
> becomes
> <cfset bigpic = trim(file.serverfile)>
> 
> You need to lock the reference to an Application variable:
> DATASOURCE= "#application.dsn#">
> or use Request.dsn instead.
> 
> Otherwise...
> 
> 
> 
>  
> 
>                     "Paul Swingewood"
> 
>                     <[EMAIL PROTECTED]        To:
> [EMAIL PROTECTED]                                       
>                     tmail.com>                 cc:
> 
>                                                Subject:     [ cf-dev ]
> Comments!                                         
>                     03/08/2004 14:24
> 
>                     Please respond to
> 
>                     dev
> 
>  
> 
>  
> 
> 
> 
> 
> Ok I think I have cracked this next phase for the backend of my shoes
> application.
> I would appreciate any comments on this code. Is this the 
> right way to do
> it
> etc .....
> 
> Just to let you know this is the modify action page which 
> modifies items
> ....
> 
> Regards - Paul
> 
> <cfparam name="PicError" default=0>
> 
> <cffile action ="UPLOAD"
> filefield ="modifiedsmallpic"
> nameconflict = "overwrite"
> accept = "image/jpg, image/pjpeg"
> destination = "c:/inetpub/wwwroot/store/images/products">
> 
> <cfif #file.filewassaved# eq "yes">
>            <cfset smallpic = '#trim(file.serverfile)#'>
>            <cffile action ="UPLOAD"
>                      filefield ="modifiedbigpic"
>                      nameconflict = "overwrite"
>                      accept = "image/jpg, image/pjpeg"
>                      destination
> = "c:/inetpub/wwwroot/store/images/products">
>            <cfif #file.filewassaved# eq "yes">
>                      <cfset bigpic = '#trim(file.serverfile)#'>
>                      <CFQUERY NAME= "update_query" DATASOURCE= "
> #application.dsn#">
>                                UPDATE tblitems
>                                SET FKmfgID =
> #trim(form.modifiedManufacturer)#,
>                                partNum = 
> '#trim(form.modifiedPartNumber)#',
>                                FKcategoryID = 
> #trim(form.modifiedCategory)
> #,
>                                subcatID = 
> #trim(form.modifiedSubCategory)#,
>                                ItemName = 
> '#trim(form.modifiedItemName)#',
>                                ItemDescription = '
> #trim(form.modifiedItemDescription)#',
>                                ItemCost = 
> #trim(form.modifiedSellingPrice)
> #,
>                                teaser = '#trim(form.modifiedTeaser)#',
>                                ItemImage = '#trim(smallpic)#',
>                                ItemBigImage = '#trim(bigpic)#'
>                                WHERE ItemID = #Form.ItemID#
>                      </CFQUERY>
>                      <!--- Now delete the sizes in the itemsizes table
> where the itemid match
>             This ensures that any old data is
> removed where an item is in size 1,2,3 
> and
>             the user modifies
> it to 1,2 (3 must be removed). In this case its easier 
> to remove
>      all the sizes and then reinsert the new ones (watch those foreign
> keys)--->
>                      <cfquery name="DeleteSizes" datasource="
> #application.DSN#">
>                                DELETE FROM tblItemSizes
>                                WHERE FKItemID = #form.itemID#
>                      </cfquery>
>                      <!--- Loop over the sizes inserting the 
> size and the
> ItemID --->
>                      <cfloop index = "ListElement"
>                                list = "#form.modifiedsize#">
>                                <cfquery name="addtoitemsizes" 
> datasource="
> #application.DSN#">
>                                           INSERT INTO tblItemSizes
>                                                     (FKItemID,
>                                                     FKSizeID)
>                                           VALUES
>                                                     
> ('#trim(form.ItemID)#',
>                                                     
> '#trim(ListElement)#')
>                                </cfquery>
>                      </cfloop>
>            <cfelse>
>                      <cfset PicError=1>
>            </cfif>
> <cfelse>
>            <cfset PicError=2>
> </cfif>
> 
> 
> 
> --
> These lists are syncronised with the CFDeveloper forum at
> http://forum.cfdeveloper.co.uk/
> Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> CFDeveloper Sponsors and contributors:-
> *Hosting and support provided by CFMXhosting.co.uk* :: 
> *ActivePDF provided
> by activepdf.com*
>       *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> proworkflow.com*
>            *Tutorials provided by helmguru.com* :: *Lists hosted by
> gradwell.com*
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> -- 
> These lists are syncronised with the CFDeveloper forum at
> http://forum.cfdeveloper.co.uk/
> Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>  
> CFDeveloper Sponsors and contributors:-
> *Hosting and support provided by CFMXhosting.co.uk* :: 
> *ActivePDF provided
> by activepdf.com*
>       *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> proworkflow.com*
>            *Tutorials provided by helmguru.com* :: *Lists hosted by
> gradwell.com*
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
> Richmond, Surrey, TW9 1DL, United Kingdom), a division of 
> Reed Business,
> Registered in England, Number 678540.  It contains 
> information which is
> confidential and may also be privileged.  It is for the 
> exclusive use of the
> intended recipient(s).  If you are not the intended 
> recipient(s) please note
> that any form of distribution, copying or use of this 
> communication or the
> information in it is strictly prohibited and may be unlawful. 
>  If you have
> received this communication in error please return it to the 
> sender or call
> our switchboard on +44 (0) 20 89107910.  The opinions 
> expressed within this
> communication are not necessarily those expressed by Reed Exhibitions.
> Visit our website at http://www.reedexpo.com
> 
> -- 
> These lists are syncronised with the CFDeveloper forum at 
> http://forum.cfdeveloper.co.uk/
> Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>  
> CFDeveloper Sponsors and contributors:-
> *Hosting and support provided by CFMXhosting.co.uk* :: 
> *ActivePDF provided by activepdf.com*
>       *Forums provided by fusetalk.com* :: *ProWorkFlow 
> provided by proworkflow.com*
>            *Tutorials provided by helmguru.com* :: *Lists 
> hosted by gradwell.com*
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> 
> 



-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to