Dave,

>We have have an issue here that I thought I had solved via locking and
>transactions, but it appears that the issue still exists.
>
>Basically, our clients go through an order entry process that produces a
>numbered requisition.  The number is based upon a value that is stored in
>the database for each client.  Multiple users of the same client can
>obviously place orders simultaneously all drawing their base number from
>the
>same location.  The section of code that actually creates the req number
>and
>stores the data is run within a serialized transaction that sits within an
>exclusive named lock.  If I'm understanding locking correctly, the
>exclusive
>named lock should prevent any other execution of that same code within the
>same application.  The serialized transaction should restrict access to the
>tables required to that single transaction, again if I'm understanding it
>correctly.

Also, if you're generating this "Request" number on a page before you
actually submit to database, then a user clicking the submit multiple times
would generate duplicate records with the same request number.

Example: on Page A you generate the request number so you can display it to
the user. Page A allows the user to confirm the creation process. When the
user clicks the "submit" button, it goes to Page B which actually inserts
the data into the database. If the user clicks the "submit" button multiple
times it can create multiple requests.

Are you ever storing this request number in any scope (Session, Form, Url,
etc?)

Also, are you absolutely positive your code is returning unique numbers?
You're locking may be working, but if there's an error in the logic you
could still produce duplicate request numbers.

For example, let's say you were creating a number based upon the current
date time stamp:

<cfset dtNow = dateFormat(now(), "yyyymmdd") & timeFormat(now(), "HHmmss")
/>

<cflock>
  <!--// insert unique number //-->
</cflock>

By creating the dtNow number outside of the lock, I'm opening myself up to
duplicate values. 

This is just an example...

-Dan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:294989
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to