AFIK, if you mean lock it while you are processing a page, you can use the
cftransaction tag:

<cftransaction isolation="serializable" action="begin">


<cftransaction action="commit"/>
</cftransaction>


Until the action="commit" part, the records selected will be locked...


However, if you are looking to lock a record while a use makes changes,
remember, the web is stateless...  Getting a record lock sustained while
waiting for a http response could be quite hazardous...  You're better off
taking a less aggressive approach to concurrency by locking out the person
who kept the record open too long.  Use a key field such as "updatedDate" or
something that will change when a record is modified.  That way if he
submits a form, and the record has been changed, you can stop the second
update.  

This is a much safer approach for one main reason:  You don't know if you'll
ever get another response from the browser.  You will have to run garbage
collection to clean out record locks if you take an aggressive stance on
record locking.  A more passive approace may result in some loss of work,
but at least the end user will not be locked out of any records...

Just my two pennies on it...

-----Original Message-----
From: Chakka, Sudheer [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 2:03 PM
To: CF-Talk
Subject: Locking a record in database!!


Hi,
        Can any one tell me how to lock a record in the table for some time.

        When One record is opened for writing through a form, I don't anyone
else to open that particular record.
        I don't know at which level this should be done either at Database
level or in ColdFusion.
        
        I have SQL Server and ColdFusion 5.0

Thanks in advance.
Sudheer Chakka


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to