Team

<cfif ParameterExists(form.add) AND ParameterExists(form.zip)>

       <cfquery name="zipcode" datasource="zipcodes">

              select state, city

              from zipcode

              where zip_code = '#form.zip#'

       </cfquery>

      

       <cfif zipcode.recordcount>

              <cflock scope="session" timeout="15">

                     <cfif NOT ParameterExists(session.targetAreas)>

                           <cflock scope="session" timeout="15">

                                  <CFSET
session.targetAreas=StructNew()>         

                           </cflock>

                     </cfif>

                           <cfset val=StructInsert(session.targetAreas,
'#form.zip#', '#zipcode.state#|#zipcode.city#','1')>

                           <cfset session.MESSAGE="Success: The
authorized user for this account was successfully set.">

              </cflock>

              

              <cfdump var="#session.targetAreas#">

              

       <cfelse>

              ...

       </cfif>

</cfif>

Now, that works!

But once I remove the locks and attempt to add values to the struct the
same as I do above, it fails - It does successfully *add* the new value,
however, it overwrites the previous value.  Must it be <cflock>'d ?

I am moving from session to client scope in my application and Id like
the same functionality as above, I do understand that storing values in
CDATA may be more wise, which is up for debate - I also understand
pramatically, client scope in and of itself is a *struct* ( which leaves
me questioning a lot of things) but I cannot for instance go:

<snip>

<cfif zipcode.recordcount>

                     <cfif NOT ParameterExists(CLIENT.targetAreas)>

                           <cfset CLIENT.targetAreas=StructNew()>

                     </cfif>

                           <cfset val=StructInsert(CLIENT.targetAreas,
'#form.zip#', '#zipcode.state#|#zipcode.city#','1')>

                           ...

              </cflock>

              

              <cfdump var="#Client.targetAreas#">

              

       <cfelse>

              ...

       </cfif>

</snip>



Nor does that work the same, not that that's obvious!

So, must it be <cflock>'d ?  Will I not be able to add to my struct
without it being <cflock>'d ?   Once Im done, I can always convert the
struct to WDDX and then store it in Client scope. ;)

Any pointers would be grateful.

Best Regards

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to