Easy to Create, Easy to Change - Easy to use!

Command::

lock



Parameters


Returns/Result


Examples


Reference

lock

Type

Processing Command

Purpose

The lock command is functional only when using DataEase on a LAN (local area network). The lock command prevents users from viewing, modifying, adding, or deleting data in forms and records being used by a report/procedure.

The lock command overrides the default multi-user locking rules assigned by the database administrator. To override the default locking rules, the first statement of the script must be either lock all files or unlock all files. If neither of these commands appears at the start of thescript, the default locking rules govern LAN functioning until a lock or unlock command appears in the script.

All lock and unlock commands are automatically terminated at the end of a script.

Syntax

lock all files .

lock file TABLENAME .

lock selected record [shared|exclusive] .

Usage

The lock all files command locks all tables referenced by the script. Users can view records in the locked tables but cannot add, delete or modify data in these tables.

The lock file command locks a specified table for the duration of the procedure or until the same table is specified in an unlock command. When an individual table or record is locked, you must also specify the type of lock (shared or exclusive). Shared lets other users view records in the locked table but prohibits those users from entering, modifying, or deleting records in that table. Exclusive prevents all access to the locked table, including viewing records.

The lock selected record command functions like lock file except it only locks the record that is currently being processed. When DataEase finishes processing a record, it is automatically unlocked. Use this command only within a for command loop (see Example 2). If you use it outside a for loop, no records are selected; therefore nothing is locked.

Example 1

lock file RESERVATIONS shared .

for MEMBERS with

( sum of RESERVATIONS TOTAL DUE > 3000) ;

list records

LAST NAME ;

TOTAL DUE .

end

 

This script tells DataEase: (1) Lock the RESERVATIONS table so other users can view records but cannot add, delete or modify RESERVATIONS records during the processing of this script, (2) select all the MEMBERS records whose related RESERVATIONS records have a combined TOTAL DUE greater than $3000, and (3) for each record selected, list the member's LAST NAME and TOTAL DUE.

Notice that locking the RESERVATIONS table during the processing of this report prevents other users from entering new records that might alter the sum of calculation.

Example 2

for MEMBERS ;

lock selected record shared .

list records

LAST NAME ;

TOTAL DUE ;

mean of RESERVATIONS TOTAL DUE .

end

 

This script tells DataEase: (1) Select all the MEMBERS records, (2) lock each record as it is selected so other users can view it but cannot add, delete or modify the record while it is being processed, and (3) for each record selected, list the member's LAST NAME, TOTAL DUE, and themean TOTAL DUE of all the related RESERVATIONS records.

In this example, all MEMBERS records can be modified except the record that is currently being processed.

See Also


On the forum about lock

Lock data tables or DQL

good Night I'm using DataEase 7.2 and Opportunistic setup I have, I'm running a DQL procedure and I need to block a table while a data update and then unlocking to continue with the procedure and another user do the same. The cod...

Product: DataEase for Windows 7.x. Written by diego fernando Ocampo 01/10/13 at 00:04:39

DataEase for DOS 4.53 Locking

I am writing this as a knowledge sharing exercise.I was working with one customer on setting up DataEase for DOS 4.53 in MS Windows environment. Windows 2003 server and Windows XP workstations. Reason for this, their Novell server crashed and t...

Product: DataEase for Windows 5.x and before.... Written by Jeyarajah Arulrajah 20/02/14 at 20:40:16

Database is locked in LAN

Hi,after Switching the OS from Windows XP to Windows 7 and the DataEase Version from 6.52. to 6.53., we get the message the database is locked.any ideas?regardsdaniel...

Product: LegEasy 6 Windows. Written by ik4-as ik4-as 08/04/14 at 07:10:19

Re:Database is locked in LAN

DataEase 6.53 comes as default (installed) as single user. If you want to run it in Network mode, you need to delete the configur.dat file in the dataeae65.local catalogue an set up depath etc.I gather you already have set up D...

Product: LegEasy 6 Windows. Written by DataEase Tech Sup 08/04/14 at 08:17:10

Locking DataEase 8.5 Database

Hi,Initially when I saw that locking feature is removed in 8.5, I was fine with it.Until I came across an issue, where locking is very important.One of the database in a multi-user environment had a report which runs statistical&n...

Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 03/05/17 at 00:25:43

Re:Locking DataEase 8.5 Database

Hi Arul, Long time no see -- how are you?Any report is a snapshot of data up to a given time (if I run it today, it does not include data from tomorrow), so could you include some cut-off time in your routines? ...

Product: Dataease [{8}]FIVE. Written by Adrian Jones 03/05/17 at 18:44:05

Re:Re:Locking DataEase 8.5 Database

Hi Adrian,Nice to hear from you. Been busy.This is an existing applicaiton upgraded from 7.1 to 8.5. I have to dig into it. To see what is happening.My guess is. If user forgets to enter today's data before 2pm. Then it should become...

Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 04/05/17 at 00:51:38

When I created a new database in DataEase 8.5.1.2674 version, I am getting BASIC as locking.

When I created a new database in DataEase 8.5.1.2674 version, I am getting BASIC as locking. See the screen shot below. How do...

Product: Dataease [{8}]FIVE. Written by 22/12/17 at 12:18:10

Re:When I created a new database in DataEase 8.5.1.2674 version, I am getting BASIC as locking.

When you create a new application from <none> (no Template) in 8.5 you get an application with the same settings as you have in PRISM.INI. Normally you crea...

Product: Dataease [{8}]FIVE. Written by DataEase 22/12/17 at 12:27:16

Locking

DearWe are currently trying to remember how to set the locking, configure & DENETWRK.Our setup is: Window Server 2016 – connected to dual speed hub.Dataease 6.52 installedZ:\ mapped with dataTSPLU...

Product: DataEase 6.x. Written by joe peart 05/03/18 at 12:51:24

Closing app with timer() don't work when the application is locked.

I have a challenge, I need to auto-close the application in the night for copying the directory, like 11pm.The KillTimer is a good base to work, it run well as long time the user have the application en front of his eyes.BUT if the user...

Product: Dataease [{8}]FIVE. Written by HONVAULT PATRICK 07/03/19 at 11:49:18

Re:Closing app with timer() don't work when the application is locked.

Hi Patrick. You set us off there and we where deep inside DE9 land with ServiceWindows, custom made login dialogues etc…. But no… The solution is/was quite simple ;-) And that is a good thing as we have an e...

Product: Dataease [{8}]FIVE. Written by DataEase 07/03/19 at 12:07:17

On the blog about lock

Troubleshooting Network Slowness - SMB and Oplocks again

1. IntroductionThe Server Message Block (SMB) Protocol is a network file sharing protocol, and as implemented in Microsoft Windows is known as Microsoft SMB Protocol. The set of message packets that defines a partic...

Product: Dataease [{8}]FIVE. Written by DataEase 06/11/18 at 15:27:49