Try appending to a table and retrieving a record count rather then
incrementing a field.

To prevent your database clogging up with crap, take a record count, purge
the logs, and record the counted information as a scheduled task every day
at 3 am or something.

I don't know the answer to your problem ;> I had the same one, I just stuck
in a work around since I was lazy ;>
----- Original Message -----
From: "Tim Rox" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 05, 2003 5:18 PM
Subject: [cfaussie] cf locking


> 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/
>


---
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