×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Hi everyone, I have a record loc

Hi everyone, I have a record loc

Hi everyone, I have a record loc

(OP)
Hi everyone,

I have a record locking problem with the InterBase. I want to lock current row when a user edit it and I want to raise an exception like "this record locked by user A" when another user try to edit same row. I am using Delphi7 and IBX objects. If Params property of IbTransaction is empty ,I can see an deadlock exception on updating the record. But I have to use READCOMMITTED. But this time, application gives no exception. How can I lock a row. Thanks.

RE: Hi everyone, I have a record loc

You can't "lock" a row... The only thing you can do is do a dummy update, then other users will get the deadlock exception. But you won't know what user locked the row...

Besides, why would you lock?

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.upscene.com

RE: Hi everyone, I have a record loc

(OP)
Thanks Martijn. You asked me why I would lock . With normal methods, users makes their changes and then update. If another user change same record before, application gives user a deadlock exception. So, User have to cancel editing and rollback. My aim is to warn user about row status before editing.
 What do you recommend me.

RE: Hi everyone, I have a record loc

I was just wondering if this deadlock situation happens a lot...

Do you need to tailor for the deadlock, or for the warning - that's the question.

I guess it depends on taste - some people like to handle the problem afterwards (deadlock), some people like to handle it before it occurs.

Anyway, you will always get a deadlock situation - even if you "lock" the row... Perhaps you can use a flag column to indicate someone is changing it - however, make sure to reset the flag afterwards, and how do you handle client-side crashes?

Food for thought, right?

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.upscene.com

RE: Hi everyone, I have a record loc

Use the security features of Interbase, define user groups and grant different rights.
Maybe use different tables. Why on earth 20 people at the same time would update the same field? What is the probability that this happens?
In Interbase you can grant rights on field level. Delphi will come with the standard message sent by Interbase: Insufficient sql rights for operation. No permission for update/write access to table TableName

Steven van Els
SAvanEls@cq-link.sr

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close