Command for creating EPLAN 21 working sets.
The EPLAN.EPLAN21.DATABASE.CREATE command is called up via the API functions as specified in the EPLAN 21 API.
All parameters have the prefix "EPL_PARAM_DATABASE_CREATE_".
ParameterID | Type | Description |
---|---|---|
NAME | [IN] String |
Name of the main database to be generated. |
DESCRIPTION | [IN, OPTIONAL] String |
Description text of the working set to be created. This text applies to all databases (main and subdatabases) belonging to a working set and can be used to clearly subdivide connected databases. |
RESDBNAME | [IN, OPTIONAL] String |
Name of the resource database to be used. The specified resource database is opened or newly created. Note concerning compatibility: If this parameter has not been set, the resource database entered in the registry is used. To stop this, set the NO_DEFAULTS parameter with the value "1". |
MACRODBNAME | [IN, OPTIONAL] String |
Name of the macro database to be used. The specified macro database is opened or newly created. Note concerning compatibility: If this parameter has not been set, the macro database entered in the registry is used. To stop this, set the NO_DEFAULTS parameter with the value "1". |
USERNAME | [IN] String |
User name for the main database. |
PASSWORD | [IN] String |
Password for the main database. |
RESDBFLAG | [IN, OPTIONAL] Boolean |
Read-only flag for the resource database. 1: Database is opened read-only. |
MACRODBFLAG | [IN, OPTIONAL] Boolean |
Read-only flag for the macro database. 1: Database is opened read-only. |
USELOCALFLAG | [IN, OPTIONAL] Boolean |
Flag for using local resources and macros 1: Use local resources and macros Local resources and macros can only be used if a resource or macro database is specified, otherwise this flag is meaningless. |
MULTIDBFLAG | [IN, OPTIONAL] Boolean |
Multi-database flag 1: Several working sets can be open at the same time. |
NO_DEFAULTS | [IN, OPTIONAL] Boolean |
Compatibility flag for the resource and macro databases. 1: Registry settings will be ignored. Note: When the RESDBNAME and MACRODBNAME parameters are described the way this flag works is explained. |
DBHANDLE | [OUT] EplHandle |
Handle to the generated main database. |
The eplExecuteCommand function returns EPL_OK if the database could be correctly created.
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 current user group does not allow the user to create a database. |
EPL_ERR_INVALID_ARGUMENT | Database name was empty. |
EPL_ERR_DATABASE_CREATE_NOTALLOWED |
A database client prohibits the generation of a database. |
EPL_ERR_DATABASE_CREATE_DB_ALREADY_OPEN | The working set could not be created since there already is an open working set. Close this working set, or set the MULTIDBFLAG parameter at the value "1". |
EPL_ERR_DATABASE_CREATE_FILE_EXISTS | The selected file name cannot be used since there is already a file of this name. |
EPL_ERR_DATABASE_CREATE_DB_NOT_CREATABLE | The main database could not be created. EPLAN 21 expects that the directory in which a database is to be created already exists. Therefore please check, whether the specified directory already exists and if you have the necessary access rights. |
EPL_ERR_DATABASE_CREATE_RESDB_NOT_CREATABLE | The resource database could not be created. EPLAN 21 expects that the directory in which a database is to be created already exists. Therefore please check, whether the specified directory already exists and if you have the necessary access rights. |
EPL_ERR_DATABASE_CREATE_MACDB_NOT_CREATABLE | The macro database could not be created. EPLAN 21 expects that the directory in which a database is to be created already exists. Therefore please check, whether the specified directory already exists and if you have the necessary access rights. |
The following example shows a function which creates a database.
EplHandle createDbTestFunc(EplSession s) { EplHandle ret; // Create command: EplHandle dbCommand = eplCreateCommand(s, L"EPLAN.EPLAN21.DATABASE.CREATE"); // Could the command be created? if(dbCommand != EPL_ERROR) { // Set database name: eplSetParam( s, dbCommand, EPL_PARAM_DATABASE_CREATE_NAME, L"c:\\tmp\\test.db" 0); // Set password: eplSetParam( s, dbCommand, EPL_PARAM_DATABASE_CREATE_PASSWORD, L"eplan", 0); // Create database: ret = eplExecuteCommand(s, dbCommand); /* Error treatment ... */ } else { /* Error treatment ... */ ret = EPL_ERROR; } eplCloseObject(s, dbCommand); return ret; } |