George, there is a great article on CFLOCK by Jim Davis; you can find a
reference to it here in our blog along with other items on CFLOCK.
http://www.webapper.net/index.cfm?frouseaction=Fuseblog.ShowComments&Article
ID=20021107042242

To your question regarding locking CFQUERY.  You should not be placing
around CFQUERY.  What you need to lock is reads and writes to shared scope
variables, these are Application, Session and Server scoped locks
(application.dsn for instance).  Going back to your query question if you
want to use shared scope variables in a CFQUERY block you should localize
them outside of the query and use the localized version in the query, as an
example

<!--- localize shared scope vars --->
<cfscript>
        request.dsn = application.dsn;
        request.userid = session.userid;
</cfscript>

<!--- use the localized vars here --->
<cfquery dbtype="ODBC" datasource="request.dsn">
        SELECT
                address1, address2
        FROM
                tbl_users
        WHERE
                fld_userid = #request.userid#
</cfquery>

A simple way to grasp the concept and need for CFLOCK is to think of a
typical Relational Database, the enterprise level ones have the capability
to lock reads and writes to a table field so that one is updating data at
the same time as another is reading it.  CFLOCK is a similar mechanism for
locking reads and writes in CF code.

Hth.

Kind Regards - Mike Brunt
Webapper Services LLC
Web Site http://www.webapper.com
Blog http://www.webapper.net

Webapper <Web Application Specialists>

-----Original Message-----
From: Bushy [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 10:50 AM
To: CF-Talk
Subject: re: <cflock When to use it?

Hi,

I'm running CF5. Should I be using <cflock on all <cfquery>? I'm not sure
when or when not to use them. Can someone explain <cflock> to me?

Thanks



[EMAIL PROTECTED]




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to