Returns information about a locked record or file.

Syntax

LKSYS(<expN>)

<expN>

A number representing the information for LKSYS( ) to return:

Value

Returns

0

Time when lock was placed

1

Date when lock was placed

2

Login name of user who locked record or file

3

Time of last update or lock

4

Date of last update or lock

5

Login name of user who last updated or locked record or file

Description

LKSYS( ) returns multiuser information contained in a _DBASELOCK field of a DBF table. For LKSYS( ) to return information, the current table must have a _DBASELOCK field. Use CONVERT to add a _DBASELOCK field to a table. If the current table doesn't contain a _DBASELOCK field, LKSYS( ) returns an empty string for any value of <expN>.

Note

LKSYS( ) works only with DBF tables.

LKSYS( ) always returns a string. When LKSYS( ) returns a date, it is a string containing the date in the current date format dictated by SET DATE and SET CENTURY. Use CTOD( ) to convert the date string to a date.

When a record is locked, either explicitly or automatically, the time, date, and login name of the user placing the lock are stored in the _DBASELOCK field of that record. When a file is locked, this same information is stored in the _DBASELOCK field of the first physical record in the table.

Passing 0, 1, or 2 as arguments to LKSYS( ) returns values only after an attempted file or record lock has failed. If a file or record lock on a converted table fails, the information for LKSYS( ) arguments 0, 1, and 2 is written to a buffer from the record's _DBASELOCK field. If you then pass 0, 1, or 2 to LKSYS( ), the information is read from the buffer. The buffer isn't overwritten until you attempt another lock that fails. Thus, 0, 1, and 2 always return the information that was current at the time of the last lock failure.

You can pass 3, 4, or 5 as arguments to LKSYS( ) whether or not the current record or file is currently locked. These arguments return information about the last successful record or file lock. When you pass any of these arguments to LKSYS( ), it returns information directly from the _DBASELOCK field rather than from an internal buffer.

If you pass 2 or 5 to obtain a user login name, and the _DBASELOCK field is only 8 characters wide, LKSYS( ) returns an empty string. The first 8 characters of a _DBASELOCK field are the count, time, and date information of the last update or lock, so the field must be wider than 8 characters to fit part or all of the login user name. Set the width of the field with CONVERT.

OODML

Check the properties of the rowset.fields[ "_DBASELOCK" ] field.