Thanks Matthew, that's what I was afraid of. What a mess... I was hoping there would be an easier solution for this. But, I guess, that's what I'll have to do.
Balazs -----Original Message----- From: Matthew Walker [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 3:26 PM To: [EMAIL PROTECTED] Subject: RE: DB locking If you have user login then consider this: You need to know who has locked the row, whether they are logged in, and if they are logged in whether they are still running the same session. If they are in the session that they were in when the row was locked then the row is still locked. To know if they are logged in, store a timestamp on their user record every time they visit a page. If it's older than say 1/2 hour they are logged out. Also assign a random session id on a new session and store it here too. When they edit a row and lock it, store the user id and the session id. When somebody else goes to edit that row, view the user id. If there is none then go for it. If there is one, check if the session id matches the session id for that user. If not then go for it. If it does match, check if the ts for that user is older than 30 min. If so then go for it, otherwise it's still locked. Whew!! It's also important to unlock the row by removing the user id when it's submitted, and to check the user still has a lock on the row, i.e. hasn't been logged out, when submitting. Regards, Matthew Walker /* Cabbage Tree Creative Ltd Christchurch - New Zealand http://www.matthewwalker.net.nz/ http://www.cabbagetree.co.nz/ */ -----Original Message----- From: Balazs Wellisch [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 9 April 2002 8:44 a.m. To: [EMAIL PROTECTED] Subject: RE: DB locking Exactly, but what if they just leav their browser and never finish what they were doing. Then the row stays locked. So could I tie this to a session variable that would unlock the row when it expires? I can't believe that there wouldn't be some low level db solution for this... -----Original Message----- From: Shannon Hicks [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 1:43 PM To: [EMAIL PROTECTED] Subject: RE: DB locking You could add a status column to the table, and flag when it should be "locked". The problem is un-locking the row too. Welcome to the wonderful world of workflow. Shan Shannon Hicks, Senior Developer Macromedia ColdFusion 5 Certified Developer duoDesgin Internet Design, Technology & Marketing 847-491-3000 main | [EMAIL PROTECTED] 847-491-3100 fax | www.duoDesign.com 847-491-7128 direct -----Original Message----- From: Balazs Wellisch [mailto:[EMAIL PROTECTED]] Sent: Monday, April 08, 2002 3:03 PM To: [EMAIL PROTECTED] Subject: DB locking Hi all, this isn't exactly a fb3 specific question but you guys might be able to help me. I have a problem where I need to restrict access to a row in a database table to one user at a time. I need to prevent users from reading or changing data in a table while that row is open in another user's browser. Is this even possible? Can I use cflock for this purpose? Knowing that the web is a stateless system how do I even know if that row is still open? Can I tie locking to a session? I'm using CF5 on Win2K with SQL2K. Any help would be appreciated. Thanks, Balazs ==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================
