urm entitycopy

Copy application data from the database to an XML file and vice versa, or convert it to another database.

urm {Switches} entitycopySource {+Source} Target {Options}

Switches

Parameters

  • Source—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.

  • Target—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
  • Options—additional parameters. The type of the Source or Target (file or database) can determine whether an option is applicable.

Options

Options Description
-noUpdate Display the operation and its results, but do not actually perform the operation. The Target must be a database.
-append Append the data to the specified file. The Target must be a file.
-silent Copy silently, without displaying messages.
-sort Copy the output in primary key order.

Depending on the database used, if this is not set, the order in the export file may differ in repeated exports, even if nothing has changed.

-map=MapFile | #{Entity | TargetEntity=SourceEntity} Use mapping functionality to determine how data is copied from existing entity and field definitions to new modeled entities and fields.
  • MapFile—ASCII file containing mapping between source and target entity and field definitions. For more information, see Mapping Files.
  • #—use Target Repository definitions to map all entities
  • #Entity—use Target Repository definitions to map the specified entity
  • #TargetEntity=SourceEntity—use Target Repository definitions to map a source entity to a target entity
-where=SelectionCritirea Select the database records to be copied. The Source must specify a database.
-tran=TranslationTable Use the specified database translation table for converting the data.

A database translation table is a keyboard translation table that is used to convert character strings during database input or output.

-library=TranslationTableLibrary Library in which the TranslationTable is located.
-noSupersede Do not replace existing occurrences. The Target must be a database.
-printinterval=Num Specify how often a message is displayed that reports the number of records copied, expressed as a number of occurrences. Default is 100.
-commitInterval= Interval Commit after the specified number of occurrences have been copied (if supported by the database). The Target must be a database.

Description

Copy data from the requested entities in the source DBMS or XML file to the target DBMS or XML file.

If either the source DBMS or target DBMS requires a password, you must include it with the /log switch. The /asn switch can also be used to specify an assignment file, which can contain logon information.

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. You need to ensure that the correct data is copied to ensure referential integrity.

Example: Using urm entitycopy

Copy data from the database to an XML file in a zip file:

urm entitycopy DEF:ENT*.MOD* xml:ziparchive.zip:mydata.xml

Copy data from multiple files to a database, and set report on progress every 10 records:

urm entitycopy xml:D:\data1.xml+xml:D:\data2.xml DEF: -printinterval=10
8078 - Copy from 'D:\data1.xml' to 'DEF:DEPARTMENT.ORG'.
8076 - Copied now 10 records/rows.
8076 - Copied now 20 records/rows.
8076 - Copied now 30 records/rows.
8074 - Copied from 'D:\data1.xml' to 'DEF:DEPARTMENT.ORG' total records/rows 35.
8078 - Copy from 'D:\data2.xml' to 'DEF:EMPLOYEE.ORG'.
8076 - Copied now 10 records/rows.
8076 - Copied now 20 records/rows.
8076 - Copied now 30 records/rows.
8076 - Copied now 40 records/rows.
8076 - Copied now 50 records/rows.
8076 - Copied now 60 records/rows.
8076 - Copied now 70 records/rows.
8076 - Copied now 80 records/rows.
8076 - Copied now 90 records/rows.
8076 - Copied now 100 records/rows.
8076 - Copied now 110 records/rows.
8076 - Copied now 120 records/rows.
8076 - Copied now 130 records/rows.
8074 - Copied from 'D:\data2.xml' to 'DEF:EMPLOYEE.ORG' total records/rows 137.

Example: Copy and Append Data to a File

Use the -append option to copy and append data to the same file:

urm entitycopy DEF:MYENT.MYMODEL xml:ziparchive.zip:myxmlfile.xml -append

Example: Copy Specific Records from a Database

Use the -where option to select one or more specific records to copy.

urm entitycopy DEF:MYENT.MYMODEL xml:mydata.xml -where="SURNAME=Jones"

Example: Copy and Commit to a Database

Use the -commit option to specify how often to commit.

urm entitycopy xml:data.xml DEF: -commit=50 

Example: Copy Using Entity Mappings

Use the -map option to use Target Repository definitions to map all entities

urm entitycopy xml:data.xml DEF:  -map=#

Related Topics