$ude ("copy")

Copies one or more entity occurrences from a source database or XML file to another.

$ude("copy","misc", Source, Target {, OptionList} )

Example: vResult = $ude("copy", "misc", "myexportfile.xml", "def:")

Caution: Do not use $ude ("copy") to export and import Repository definitions. This can cause corruption of the Uniface Repository. Instead, use the $ude ("export") and $ude ("import") functions.

Parameters

Parameters
Parameter Data Type Description
Source String Source of data to be copied. One of:
  • Database path and entity: Path:Entity.Model

    Path can specify a connector path (such as XML, DEF, ORA), or a user-defined path (such as $ORA or $MyData).

    Either or both of Entity and Model can contain wildcards, for example DEF:ENT*.MOD*.

  • XML file: {ZipArchive:}Filename

    For example, myxmlfile.xml or ziparchive.zip:myxmlfile.xml

    When a ZipArchive is specified, it is created in the Zip64 format.

  • Uniface 8 TRX file: trx:Filename
Target String Destination database path or XML file.
  • Database objects: Path:

    Entity and/or model names following the path are ignored.

  • XML file: xml: or {ZipArchive:}Filename
OptionList String Associative list containing one or more options that are appropriate to the operation or the ObjectType.

Arguments can also be a field, variable, or function that evaluates to a string or list.

Use

Allowed in all Uniface component types.

Description

The $ude ("copy") function copies one or more entity occurrences from a source database or file to another.

If the data source is a database, you can specify which entities and occurrences to copy using the where option. Make sure you compile the modeled entities to be exported. This is required to ensure entity descriptors are generated as .edc files. If entity descriptors are missing, the copy action will fail with message

8066 - Copy failed: Open error on input file/table Source

When copying data into a database, Uniface does not know anything about the contents of the source data and performs a physical conversion. The copy process does not consider referential integrity constraints, so it is possible to copy the data from one entity without its related entities. As a developer, you need to ensure that the correct data is copied to ensure referential integrity.

Caution: Do not use $ude ("copy") to export and import Repository definitions. This can cause corruption of the Uniface Repository. Instead, use the $ude ("export") and $ude ("import") functions. For more information, see Export and Import Facilities.

If the data target is an XML file, you can append data to it using the append option. However, if an XML file was originally created with Uniface's export functionality, it is not possible to append data to it using the copy functionality.

Converting Data Using the Map Option

You can use mapping functionality to specify how data is copied from existing entity and field definitions to new model definitions.

By default, entities are copied using descriptors in the Source to map entities to the Target, but you can override this and provide your own mapping rules.

If you specify the map=# options, the entity descriptors in the Target are used instead of those in the Source.

Alternatively, you can also specify your own mappings in a map file. For more information, see Mapping Files.

Converting Data

The following instructions convert data via the default path from the default Repository to an XML file and to an XML file in a zip archive.

vResult = $ude("copy", "misc", "def:myent.mymodel", "myexportfile.xml")
vResult2 = $ude("copy", "misc", "def:myent.mymodel", "myzip.zip:myexportfile.xml")

The following instruction converts the contents of an XML file to the database via the default path:

$result = $ude("copy", "misc", "myexportfile.xml", "def:")

Related Topics