EPLAN.EPLAN21.DATABASE.OPEN

Contents

Description

Command for opening EPLAN 21 working sets.

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

Parameters

All parameters have the prefix "EPL_PARAM_OPENDB_".

ParameterID Type Description
DBNAME [IN]
String

Name of the main database or subdatabase to be opened.

The command opens all databases associated with a working set.

DBFLAG [IN, OPTIONAL]
Boolean

Read-only flag for the main and subdatabases.

1: Databases are opened read-only.
0: Databases are opened read-write (default).

Note: Main and subdatabases should always be opened in the read-only mode and then be locked for editing it with the EPLAN.EPLAN21.DATABASE.LOCK command in exclusive use.

One use the default behavior of these commands for exceptions or when you do not intend to access a database together with several users at the same time.

If you wish to open a database read-write and the MULTIDBFLAG has not been set, the database is automatically locked for exclusive access. If this is not possible since the respective database has already been exclusively opened by another user, the database will not be opened, and the error message EPL_ERR_DATABASE_LOCK_LOCKED_BY_OTHER will be returned.

RESDBNAME [IN, OPTIONAL]
String

Name of the resource database that is to be opened together with the working set.

RESDBFLAG [IN, OPTIONAL]
Boolean

Read-only flag for the resource database.

1: Database is opened read-only.
0: Database is opened read-write (default).

MACRODBNAME [IN, OPTIONAL]
String

Name of the macro database that is to be opened together with the working set.

MACRODBFLAG [IN, OPTIONAL]
Boolean

Read-only flag for the macro database.

1: Database is opened read-only.
0: Database is opened read-write (default).

MULTIDBFLAG [IN, OPTIONAL]
Boolean

Multi-database flag

1: Several working sets can be open at the same time.
0: Only one working set can be open at a time. Open working sets will automatically be closed (default)

DBHANDLE [OUT]
EplHandle

Handle to the open main database

Error Messages

The eplExecuteCommand function returns EPL_OK if the working set could be correctly opened.

If the command fails, eplExecuteCommand returns the value EPL_ERROR. In this case, the error log can contain the following errors:

ErrorID Description
EPL_ERR_NO_RIGHT The attempt was made to open the resource or macro database read-write, without the current user group allowing this.
EPL_ERR_OPENDB_CANNOT_OPEN Error message does not occur.
EPL_ERR_OPENDB_OPENED_READ_ONLY Error message does not occur.
EPL_ERR_OPENDB_DB_NOT_FOUND The main or subdatabase could not be found.
EPL_ERR_OPENDB_RESDB_NOT_FOUND The resource database could not be found.
EPL_ERR_OPENDB_RESDB_ALREADY_OPEN Error message does not occur.
EPL_ERR_OPENDB_RESDB_CONVERSION_FAILED The resource database could not be converted.
EPL_ERR_OPENDB_RESDB_TYPEMISMATCH Wrong database type (macro database as resource database or something similar).
EPL_ERR_OPENDB_RESDB_WRONG_MODE Wrong mode (e.g. if the resource database is specified without using separate databases).
EPL_ERR_OPENDB_MACDB_NOT_FOUND The macro database could not be found.
EPL_ERR_OPENDB_MACDB_ALREADY_OPEN The macro database was already open.
EPL_ERR_OPENDB_MACDB_CONVERSION_FAILED The macro database could not be converted.
EPL_ERR_OPENDB_MACDB_TYPEMISMATCH Wrong database type (resource database as macro database or something similar).
EPL_ERR_OPENDB_MACDB_WRONG_MODE Wrong mode (e.g. if a macro database is specified without using separate databases).
EPL_ERR_INVALID_ARGUMENT Database name was empty.
EPL_ERR_OPENDB_DBCLIENT_OPEN

A database client prohibits the opening of a database.

EPL_ERR_OPENDB_DB_ALREADY_OPEN A working set can only be opened once by a client. When the attempt is made to open a working set for the second time this error message is output.
EPL_ERR_OPENDB_DB_CONVERSION_FAILED One of the main databases or subdatabases to be opened could not be converted.
EPL_ERR_OPENDB_DB_TYPEMISMATCH Wrong database type (project database as resource database or macro database).
EPL_ERR_OPENDB_DB_WRONG_MODE Wrong mode (e.g. if a resource database or macro database is specified without using separate databases).
EPL_ERR_OPENDB_DB_SCHEMA_MISMATCH The database scheme of the main or subdatabase to be opened does not match the scheme that is expected by EPLAN 21.
EPL_ERR_OPENDB_RESDB_SCHEMA_MISMATCH The database scheme of the resource database to be opened does not match the scheme that is expected by EPLAN 21.
EPL_ERR_OPENDB_MACDB_SCHEMA_MISMATCH The database scheme of the macro database to be opened does not match the scheme that is expected by EPLAN 21.
EPL_ERR_OPENDB_DB_NO_CONNECTION No connection can be established to the ObjectStore server on which the main or subdatabase is stored.
EPL_ERR_OPENDB_RESDB_NO_CONNECTION No connection can be established to the ObjectStore server on which the resource database is stored.
EPL_ERR_OPENDB_MACDB_NO_CONNECTION No connection can be established to the ObjectStore server on which the macro database is stored.
EPL_ERR_OPENDB_DB_NOT_A_DATABASE The main database to be opened is no ObjectStore database.
EPL_ERR_OPENDB_RESDB_NOT_A_DATABASE The resource database to be opened is no ObjectStore database.
EPL_ERR_OPENDB_MACDB_NOT_A_DATABASE The macro database to be opened is no ObjectStore database.
EPL_ERR_OPENDB_DB_NO_PERMISSION It is not permitted to access a main or subdatabase to be opened.
EPL_ERR_OPENDB_RESDB_NO_PERMISSION It is not permitted to access the resource database to be opened.
EPL_ERR_OPENDB_MACDB_NO_PERMISSION It is not permitted to access the macro database to be opened.
EPL_ERR_OPENDB_SLAVEDB_NOT_FOUND One of the subdatabases belonging to the working set could not be found. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_ALREADY_OPEN One of the subdatabases to be opened is already open. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_CONVERSION_FAILED One of the subdatabases to be opened could not be converted. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_TYPEMISMATCH One of the subdatabases to be opened has the wrong database type (main, resource or macro database). The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_WRONG_MODE Wrong mode (e.g. if a resource database or macro database is specified without using separate databases). The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_SCHEMA_MISMATCH The database scheme of the subdatabase to be opened does not match the scheme that is expected by EPLAN 21. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_NO_CONNECTION No connection can be established to the ObjectStore server on which a subdatabase to be opened is stored. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_NOT_A_DATABASE One of the subdatabases to be opened is not an ObjectStore database. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_NO_PERMISSION It is not permitted to access one of the subdatabases to be opened. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_MASTERNOTLOCKED One of the subdatabases to be opened does not have the internal link to the main database. EPLAN 21 tries to automatically re-establish this link. This does not work if the main database is not locked. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_SLAVEDB_WRONGMASTER One of the subdatabases to be opened contains a link to another main database than the one that is currently open. The name of this subdatabase can be queried via the EPL_PARAM_COMMAND_ERROR_PARAM01 property.
EPL_ERR_OPENDB_DB_FILE_NOT_CREATABLE Error cannot occur.
EPL_ERR_OPENDB_RESDB_FILE_NOT_CREATABLE The resource database to be used does not exist. The attempt to recreate this database failed.
EPL_ERR_OPENDB_MACDB_FILE_NOT_CREATABLE The macro database to be used does not exist. The attempt to recreate this database failed.
EPL_ERR_OPENDB_SLAVEDB_FILE_NOT_CREATABLE Error cannot occur.

Example

The following example shows a function which opens a database and the associated resource database. Resource database is opened read-only.

EplHandle
openDbTestFunc(EplSession s)
{
        EplHandle ret;

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

        // Could the command be created?
        if(dbCommand != EPL_ERROR)
        {
                // Set database name:
                eplSetParam(
                        s,
                        dbCommand,
                        EPL_PARAM_OPENDB_DBNAME,
                        L"c:\\tmp\\test.db"
                        0);
                // Name of resource database:
                eplSetParam(
                        s,
                        dbCommand,
                        EPL_PARAM_OPENDB_RESDBNAME,
                        L"c:\\tmp\\res_test.db",
                        0);
                // Resource database is to be opened read-only.
eplSetParam( s, dbCommand, EPL_PARAM_OPENDB_RESDBFLAG, L"1", 0); ret = eplExecuteCommand(s, dbCommand); } else { /* Error treatment ... */ ret = EPL_ERROR; } eplCloseObject(s, dbCommand); return ret; }

Reference