EPLAN.EPLAN21.DATABASE.LOCK

Contents

Description

Command for locking a database.

The EPLAN.EPLAN21.DATABASE.LOCK command is called up via the API functions as specified in the EPLAN 21 API.

Parameters

All parameters have the prefix "EPL_PARAM_DATABASE_LOCK_".

ParameterID Type Description
DBHANDLE [IN]
EplHandle

Name of the database to be locked.

The command closes the specified database and reopens it with write access.

RECOVER [IN, OPTIONAL]
Boolean

Recover flag for invalid locks.

1: Invalid locks will be removed.
0: Invalid locks will be retained (default).

Error Messages

The eplExecuteCommand function returns EPL_OK if the database could be correctly locked.

ErrorID Description
EPL_ERR_DATABASE_LOCK_INVALID_DATABASE

The transferred handle is invalid.

EPL_ERR_DATABASE_LOCK_DB_NOTOPENED

The database to be locked is not open.

EPL_ERR_DATABASE_LOCK_DB_READONLY

The database to be locked cannot be opened with write access.

EPL_ERR_DATABASE_LOCK_LOCKED_BY_OTHER

The database to be locked has been locked by another client.

Example

The following example shows a function which locks an open database.

EplHandle
lockDatabase(EplSession s, EplHandle dbHandle)
{
        EplHandle ret = EPL_ERROR;

        // Create command:
        EplHandle cmd =
                eplCreateCommand(s, "EPLAN.EPLAN21.DATABASE.LOCK");

        // Could the command be created?
        if(cmd != EPL_ERROR)
        {
		// Set handle of main database
		eplSetParamHandle(
			s,
			cmd,
			EPL_PARAM_DATABASE_LOCK_DBHANDLE,
			dbHandle
			0);

                ret = eplExecuteCommand(s, dbCommand);
        }

        eplCloseObject(s, cmd);
        return ret;
}

Reference