Hello all,

Am currently trying to track the number of times a page is accessed by
incrementing a field in my database.

I thought i would check that it was counting correctly for many concurrent
users by using a loop with 50 http requests for my page. I ran this page
through two browsers simultaneously.

Even though i have a lock with the scope "application" around my code for
incrementing, i still get values of around 90-100 at the end of requesting
the page 100 times (50 requests x 2 browsers).

I shouldn't really be getting concurrency problems if i have an
application-level lock should I?

the code looks something like:

<cflock timeout="1000" throwontimeout="No" scope="APPLICATION"
type="EXCLUSIVE">
<cftransaction>
        <cfquery name="qAd" datasource="#session.DSN#">
                SELECT clicks
                FROM theTable
                WHERE ID=1
        </cfquery>
        <cfset incrementclicks=qAd.clicks+1>
        <cfquery name="uAd" datasource="#session.DSN#">
                UPDATE theTable
                SET clicks=#incrementclicks#
                WHERE ID=1
        </cfquery>
</cftransaction>
</cflock>



-----------------------

Tim Roxburgh
Newgency Pty Ltd
2a Broughton St
Paddington 2021
Sydney, Australia
Ph (02) 9331 2133
Fax (02) 9331 5199
http://www.newgency.com/index.cfm?referer=rysig


---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to