USMeta.Tables

Previous Next

At runtime, gets metadata information about tables from the model developed in USoft Definer. For each retrieved table, this information takes the form of name/value pairs that express table attribute settings (column name and column value).

Returns an XML document of the form demonstrated in Example 1 below.

Syntax

SELECT USMeta.Tables(

       table-name-pattern           Tables

,      include-database-tables      IncludeDatabaseTables

,      include-logical-views        IncludeViews

,      include-component-tables     IncludeComponentTables

,      interfaces-only              InterfacesOnly

)

 

include-database-tables    :=  { yes-value | no-value }

include-logical-views      :=  { yes-value | no-value }

include-component-tables   :=  { yes-value | no-value }

 

interfaces-only            :=  { yes-value | no-value }

 

yes-value                  :=  A value from the set { 'yes', 'Y', 'true', '1' } regardless of case

no-value                   :=  Any value other than a yes-value

All parameters are optional. Parameter values that you supply are mapped to parameters by alias name. The 'No' value in the following example is for include-logical-views because of the "IncludeViews" alias:

SELECT        USMeta.Tables( 'No' IncludeViews )
 

(For backward compatibility only, it is possible to supply parameter values by position. Using this syntax, a list of non-aliased values maps to the parameter list in the order stated, with empty values at the end of the list if you supply less than 5 values, and '' (the empty string) as a way of explicitly declaring an empty value.)

Table-name-pattern is a regular expression that matches zero, one or more table names in the model. The result data is limited to tables matching the pattern. If table-name-pattern is omitted, then result data is not limited in this way.

If include-database-tables is set to 'yes' (the default), all database tables are included in the result, including interface tables that are database tables in the provider module.

If include-logical-views is set to 'yes' (the default), all logical views are included in the result, including interface tables that are logical views in the provider module.

If include-component-tables is set to 'yes' (the default), all component tables are included in the result, including interface tables that are component tables in the provider module.

If interfaces-only is set to 'yes', only tables that have the Interface = Yes flag are included. Do not confuse this category with the category of tables listed in the Definer Catalog as "Interface Tables", that is, tables provided by other modules. The default of interfaces-only is 'no', meaning that tables are included regardless of the value of their Interface flag.

Example 1

This example returns table information about the DISCOUNT table.

SELECT USMeta.Tables( 'DISCOUNT' Tables )

The return value of this statement could be:

<?xml version="1.0" encoding="UTF-16"?>
<Meta>
  <Tables>
    <Table TABLE_NAME="DISCOUNT" MODULE_NAME="TRAVEL" TABLE_SHORT="DC" OBJECT_NAME="Discount Range" 
      OBJECT_NAME_PLURAL="Discount Ranges" PHYSICAL_NAME="DISCOUNT" TABLE_TYPE="DATABASE" 
      IS_SUBTYPE="N" NR_OF_COLUMNS="4" NR_OF_VR_COLUMNS="0" NR_OF_INDEXES="0"/>
  </Tables>
</Meta>

 

Example 2

This example returns table information about all database tables that have a table name starting with 'P' followed only by other letters, such as 'PERSON' and 'PARTICIPANT' but not 'P_TOTAL'. Logical Views and Component Tables are not included.

SELECT USMeta.Tables( 
       '^P[A-Z]*$'     Tables
,      'yes'           IncludeDatabaseTables
,      'no'            IncludeViews
,      'no'            IncludeComponentTables
)

 

Example 3

You can use USMeta.Tables() to determine exactly what type(s) of table you want to export with XML.MultiExportTables(). This way, you can export only database tables and not other types of table such as component tables and logical views.

 

 

See also

USMeta.Columns

USMeta.Relationships

Example: exporting only database tables