Record locking (Delphi 2 Paradox 5)

Question:
We are trying to write a multi-user Delphi 2.0 app (with Paradox 5.0 tables), and are looking for a way to determine if a record is locked by another machine before we attempt to modify it. I have tried to use the DbiIsRecordLocked function, to no avail. It always returns false, even if I have called DbiGetRecord or Table.Edit. The BDE knows it’s locked because a subsequent call to DbiGetRecord or edit on that record raises an exception (Record locked by user: username). Is DbiIsRecordLocked supposed to work across a network (netware or NT), and if so, how is it used correctly?

Answer:
This is one of the “problems” with the Paradox locking scheme. It’s notenough to just be in Edit mode. In order to create a “locked” condition on arecord, you have to physically change it in some way. One way I’ve gottenaround this is to create a dummy field of a single byte that gets changed assoon as a user lands on a record. This puts therecord into a locked state that can then be checked with DBIIsRecordLockedfrom other machines. It’s not the prettiest technique, but it works.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS