Record locking (Delphi 2 Paradox 5)

Record locking (Delphi 2 Paradox 5)

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?

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.

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist