Using Extended Attributes During Generation

Extended attributes are created to control generation: each extended attribute value can be used as a variable that can be referenced in the scripts defined in the Script category.

Some DBMS include predefined extended attributes. For example in PostgreSQL, domains include default extended attributes used for the creation of user-defined data types.



You can create as many extended attributes as you need, for each DBMS supported object.

Note:

PowerDesigner variable names are case sensitive. The variable name must be an exact match of the extended attribute name.

Example

In DB2 UDB 7, extended attribute WhereNotNull allows you to add a clause that specifies that index names must be unique provided they are not null.

In the Create index order, WhereNotNull is evaluated as shown below:

create [%INDEXTYPE% ][%UNIQUE% [%WhereNotNull%?where not null ]]index [%QUALIFIER%]%INDEX% on [%TABLQUALIFIER%]%TABLE% (

%CIDXLIST%

)

[%OPTIONS%]

If the index name is unique, and if you set the type of the WhereNotNull extended attribute to True, the "where not nul" clause will be inserted in the script.

In the SqlListQuery item:

{{OWNER, TABLE, INDEX, INDEXTYPE, UNIQUE, INDEXKEY, CLUSTER, WhereNotNull}

select 
 tbcreator,
 tbname,
 name,
 case indextype when '2' then 'type 2' else 'type 1' end,
 case uniquerule when 'D' then '' else 'unique' end, 
 case uniquerule when 'P' then 'primary' when 'U' then 'unique' else '' end, 
 case clustering when 'Y' then 'cluster' else '' end,
 case uniquerule when 'N' then 'TRUE' else 'FALSE' end
from
 sysibm.sysindexes 
where 1=1
[  and tbname=%.q:TABLE%]
[  and tbcreator=%.q:OWNER%]
[  and dbname=%.q:CATALOG%]
order by
 1 ,2 ,3


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com