EPLAN.EPLAN21.DATABASE.COMPRESS

Contents

Description

Command for compressing a project database.

The "EPLAN.EPLAN21.DATABASE.COMPRESS" command is called up via the API functions specified in EPLAN 21 API and is only available if the epm.erx system expansion has been loaded.

This command can be used for compressing a database. In the case of a database for a 2 or 3 database environment, only the projects or macros will be compressed at the moment.

Parameters

All parameters have the prefix "EPL_PARAM_COMPRESS_".

ParameterID Type Description
DBNAME [IN]
String
Name of the database to be compressed.
DESTDBNAME [IN]
String
Name of the database to be created as backup file.
DESTRESDBNAME [IN, OPTIONAL]
String
Name of the resource database to be used.
DESTMACRODBNAME [IN, OPTIONAL]
String
Name of the macro database to be used.
PASSWORD [IN]
String
New password for compressed database.
USER [IN, OPTIONAL]
String
Name of the user who creates the compressed database.

Error Messages

The eplExecuteCommand function returns EPL_OK if the compression could be correctly executed.

If the command fails, eplExecuteCommand returns the value EPL_ERROR. The ERROR_ID of the entries in the error log can be individually queried via the indexed parameter EPL_PARAM_COMMAND_ERROR_ID. The EPL_PARAM_COMMAND_ERROR_DESCRIPTION parameter with identical index contains an error description for the ERROR_ID.

When this command is used, system errors may occur which are characterized by the ID "EPL_ERR_GENERAL" or errors that are listed under EPLAN.EPLAN21.DATABASE.CLOSE, EPLAN.EPLAN21.DATABASE.CREATE, and EPLAN.EPLAN21.DATABASE.OPEN.

ErrorID Description
EPL_ERR_GENERAL A system error has occurred.

Example

The following example shows a Visual Basic function which compresses a database.


' Compress the specified database
'
Function eplanCompressDatabase(Session As EplSession, strDBName As String) As Long
Dim retval As Long
Dim hCommand As Long

    ' create a new command
    hCommand = EPLAN.createCommand(Session, "EPLAN.EPLAN21.DATABASE.COMPRESS")
    If (hCommand <> EPL_ERROR) Then

        'The database to be compressed
        retval = EPLAN.setParam(Session, hCommand, PARAM_COMPRESS_DBNAME, _
            strDBName, 0)

        'Create a backup file with the same name + "Backup"
        retval = EPLAN.setParam(Session, hCommand, PARAM_COMPRESS_DESTDBNAME, _
            strDBName & "Backup", 0)

        'The password
        retval = EPLAN.setParam(Session, hCommand, PARAM_COMPRESS_PASSWORD, _
            "eplan", 0)

        'User name
        retval = EPLAN.setParam(Session, hCommand, PARAM_COMPRESS_USER, _
            "test user", 0)

        'Execute the command
        retval = EPLAN.executeCommand(Session, hCommand)
        eplanCompressDatabase = retval

    End If

    ' close Command
    retval = EPLAN.closeObject(Session, hCommand)
End Function

Reference