Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3457066
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:48:54+00:00 2026-05-18T09:48:54+00:00

I am about to implement a record locking mechanism as follows: Table1: Field: ID

  • 0

I am about to implement a record locking mechanism as follows:

Table1:
    Field: "ID" (AutoIncrement, Primary)
    Field: "Name" (Text)
    Field: "More fields..."

Table2:
    Field: "ID" (Unique)

In order to lock a specific record in Table1, I’ll create a record in Table2 with the same ID. If this creation fails due to such a record already existing, then the record must be locked by another process and I spin. If it succeeds, I have the lock and can modify the record. When I’m done, I delete the lock record in Table2.

My question is whether this is a valid way to implement a per-record lock, and if not, is there such a thing?

Cheers,
Charlie.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:48:55+00:00Added an answer on May 18, 2026 at 9:48 am

    You can use innodb for row-based locking,
    or even read-lock instead of impose locking to another table,
    (rather to let mysql to handle race-condition)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As I learn more and more about OOP, and start to implement various design
I'm about to implement a small program where i need the elapsed seconds since
We are just about to implement full blown TFS 2008 across our development team
I'm about to implement a feature on my website that recommends content to users
I'm about to implement a slider control component in .NET that's along the lines
The Problem: I'm about to implement language localization to an already very large ipad
This is a question about how to implement the equals method when I need
I've seen articles online about how to implement them, but I still don't understand
Can anybody point me to a simple example about how to implement form based
I was wondering about how to exactly implement domain service in RIA. Is it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.