XML.MultiExportTables

Previous Next

Exports data to the USoft multi-table format on the basis of a regular expression identifying a set of tables.

Subtype indicators are NOT exported. See also the RestrictiveSupertypeListing parameter in this help topic.

Using this method, you can create an output file with data from multiple tables. You can use XML.IMPORT to re-import this result set into a target repository where each of the tables is present.

Syntax

INVOKE XML.MultiExportTables WITH SELECT
    regular-expression
,   parameter,    value
,   ...      ,    ...

The required regular-expression identifies the set of tables from which data is exported.

The optional parameter-value pairs specify additional options. See the Parameters section in this help topic.

You can append WHERE clauses to restrict the output to records that match WHERE conditions. See the "Appended WHERE clauses" section in this help topic.

Example 1

This statement, executed in USoft Definer, returns an XML document describing the structure and contents of tables T_TABLE, T_COLUMN and T_DOMAIN:

INVOKE XML.MultiExportTables WITH SELECT
    '(T_TABLE|T_COLUMN|T_DOMAIN)'

Example 2

This statement, if executed in your User Application, or in any USoft application such as Definer or Authorizer, returns an XML document describing the structure and contents of ALL tables. This may run into errors if the output includes component tables; see Example 3 for a solution.

INVOKE XML.MultiExportTables WITH SELECT
    '(.*)'

Example 3

This example is a solution to problems you may run into if the following statement raises an error when attempting to query a component table:

INVOKE XML.MultiExportTables WITH SELECT
    '(.*)'

To get around this error, you can call usmeta.tables(). The following example exports database tables, but not other types of table:

INVOKE XML.MultiExportTables WITH 
SELECT usxsl.apply
   (
      usmeta.tables()
   ,   '<?xml version="1.0" encoding="windows-1252"?>
        <xsl:stylesheet  version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:output method="text" encoding="UTF-8" omit-xml-declaration="no"/>
 
          <xsl:template match="/">
            <xsl:for-each select="*/*/*[@TABLE_TYPE=''DATABASE'']">
               <xsl:if test="position() &gt; 1">|</xsl:if>
               <xsl:value-of select="@TABLE_NAME"/>                
             </xsl:for-each>
           </xsl:template>
 
         </xsl:stylesheet>'
   )
,   'ConvertWhiteSpaces', 'yes'
,   'ProcessingInstruction', 'yes'
,   'WriteOutputTo', 'c:\temp\mydatabasetables.xml'

 

 

collapseParameters
collapseAppended WHERE clauses
collapseSubstitution variables in appended WHERE
collapseBehaviour with subtypes

 

See also

Example: exporting only database tables