USMeta.Columns

Previous Next

At runtime, gets metadata information about columns from the model developed in USoft Definer. This information takes the form of column attribute settings, but also contains relevant attribute settings done in USoft at domain level, for example, information about datatype, column length, and allowed values.

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

Syntax

SELECT USMeta.Columns(

       table-name-pattern     Tables

,      column-name-pattern    Columns

,      interfaces-only        InterfacesOnly

)

 

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 pass are mapped to parameters by alias name. The 'ID' value in the following example is for column-name-pattern because of the "Columns" alias:

SELECT        USMeta.Columns( 'ID' Columns )

 

(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 3 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.

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

If interfaces-only is set to 'yes', only columns that have Interface = Yes are included. The default of interfaces-only is 'no', meaning that columns are in scope regardless of the value of their Interface attribute.

Example 1

This example returns column information about any columns in the model that have Column Name = 'ID' :

SELECT USMeta.Columns( 
   '.*'     Tables
,  'ID'   Columns
)

The return value of this statement could be:

<?xml version="1.0" encoding="UTF-16"?>
<Meta>
  <Columns>
    <Column COLUMN_NAME="ID" TABLE_NAME="RESERVATION" TABLE_MODULE="TRAVEL" PRIMARY_KEY="N" FOREIGN_KEY="Y" MANDATORY="Y" INPUT_ALLOWED="Y" QUERY_ALLOWED="Y" UPDATABLE="Y" DISPLAYED="Y" INTERFACE="N" DEF_VALUE="" COLUMN_TYPE="DATABASE" PROMPT="Scheduled Tour No" COLUMN_HELP_TEXT="ID Number of Scheduled Tour for which this reservation is made" DOMAIN_NAME="SCHEDTOUR_ID" DATATYPE="NUMBER" TOTAL_LENGTH="4" LENGTH_AFTER_PERIOD="0" DISPLAY_DATATYPE="INT" DISPLAY_LENGTH="0" DISPLAY_LENGTH_AFTER_PERIOD="0" UPPERCASE="N" FIXED_LENGTH="N" IS_SEQNO="Y" UNICODE_TYPE="N" RANGE_LOW="" RANGE_HIGH="" DOMAIN_HELP_TEXT="" REG_EXP="" DOMAIN_MODULE="TRAVEL" IO_FORMAT=""/>
    <Column COLUMN_NAME="ID" TABLE_NAME="SCHEDTOUR" TABLE_MODULE="TRAVEL" PRIMARY_KEY="Y" FOREIGN_KEY="N" MANDATORY="Y" INPUT_ALLOWED="N" QUERY_ALLOWED="Y" UPDATABLE="Y" DISPLAYED="Y" INTERFACE="Y" DEF_VALUE="" COLUMN_TYPE="DATABASE" PROMPT="Scheduled Tour ID" COLUMN_HELP_TEXT="This Scheduled Tour&apos;s ID number" DOMAIN_NAME="SCHEDTOUR_ID" DATATYPE="NUMBER" TOTAL_LENGTH="4" LENGTH_AFTER_PERIOD="0" DISPLAY_DATATYPE="INT" DISPLAY_LENGTH="0" DISPLAY_LENGTH_AFTER_PERIOD="0" UPPERCASE="N" FIXED_LENGTH="N" IS_SEQNO="Y" UNICODE_TYPE="N" RANGE_LOW="" RANGE_HIGH="" DOMAIN_HELP_TEXT="" REG_EXP="" DOMAIN_MODULE="TRAVEL" IO_FORMAT=""/>
  </Columns>
</Meta>

 

Example 2

This example returns column information about all DATE interface columns in table RESERVATION (for example, BOOK_DATE, START_DATE, END_DATE and CANCEL_DATE) that have Interface = Yes:

SELECT USMeta.Columns( 
    'RESERVATION'       Tables
,   '^[A-Z|_]*DATE$'    Columns
,   'yes                InterfacesOnly
)

 

See also

USMeta.Tables

USMeta.Relationships