USMeta.Relationships

Previous Next

At runtime, gets metadata information about relationships from the model developed in USoft Definer. This information includes attribute settings of the relationship itself, as well as a list of parent table column - child table column pairs. These column pairs show how records in the child table refer to the corresponding parent record.

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

Syntax

SELECT USMeta.Relationships(

       parent-table-name-pattern   Parents

,      child-table-name-pattern    Children

,      role-name-pattern           Roles

)

All parameters are optional. Parameter values that you pass are mapped to parameters by alias name. The 'PERSON' value in the following example is for parent-table-name-pattern because of the "Parents" alias:

SELECT        USMeta.Relationships( 'PERSON' Parents )

 

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

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

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

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

Example 1

This example returns relationship information on all relationships that have the SCHEDTOUR table als their parent table:

SELECT USMeta.Relationships( 'SCHEDTOUR' Children )

The return value of this statement could be:

<?xml version="1.0" encoding="UTF-16"?>
<Meta>
  <Relationships>
    <Relationship PARENT_TABLE="GUIDE" CHILD_TABLE="SCHEDTOUR" ROLE="GUIDES" CO_ROLE="are guided by" 
        ALIAS_PARENT="" MENU_LINE="Scheduled Tours guided by this Guide" REV_MENU_LINE="Guides guiding Scheduled Tours" 
        LOOKUP_METHOD="WINDOW_PAGE" DELETE_RULE="RESTRICTED" UPDATE_RULE="RESTRICTED" CHILD_MANDATORY="N" 
        MIN_NO_OF_CHILDREN="0" MAX_NO_OF_CHILDREN="0" FK_MANDATORY="N" LOCK_ON_FK_CHECK="Y" FK_CHECK_PARTIAL="Y" FK_UPDATABLE="Y">
      <Relationship_Columns>
        <Column PARENT="PERSON_ID" CHILD="GUIDE"/>
      </Relationship_Columns>
    </Relationship>
    <Relationship PARENT_TABLE="TOUR" CHILD_TABLE="SCHEDTOUR" ROLE="IS SCHEDULED AS" CO_ROLE="are described by this" 
      ALIAS_PARENT="" MENU_LINE="Scheduled Tours described by this Tour" REV_MENU_LINE="Tours scheduled as Scheduled Tours" 
      LOOKUP_METHOD="WINDOW_PAGE" DELETE_RULE="RESTRICTED" UPDATE_RULE="CASCADING" CHILD_MANDATORY="N"
      MIN_NO_OF_CHILDREN="0" MAX_NO_OF_CHILDREN="0" FK_MANDATORY="Y" LOCK_ON_FK_CHECK="Y" FK_CHECK_PARTIAL="Y" FK_UPDATABLE="Y">
        <Relationship_Columns>
          <Column PARENT="DESTINATION" CHILD="DESTINATION"/>
          <Column PARENT="TOUR_TYPE" CHILD="TOUR_TYPE"/>
        </Relationship_Columns>
    </Relationship>
  </Relationships>
</Meta>

 

Example 2

This example returns relationship information about all relationships that have as their child table name an alphanumeric uppercase string that contains 'SCHEDTOUR':

SELECT USMeta.Relationships( '^[A-Z]*SCHEDTOUR[A-Z]*$' Children )

 

See also

USMeta.Tables

USMeta.Columns