Chapter 3 DBMS Reference Guide


Extension mechanism for ODBC reverse engineering queries

During reverse engineering, PowerDesigner executes queries to retrieve information from the columns of the system tables. The result of a query is mapped to PowerDesigner internal variables via the query header. When the system tables of a DBMS store information in columns with LONG, BLOB, TEXT and other incompatible data types, it is impossible to concatenate these information in a string.

You can bypass this limitation by creating user-defined queries and user-defined variables in the existing reverse engineering queries. These queries are also called extended queries.

During reverse engineering, queries are executed to evaluate variables and create a string statement. When the query header contains the EX keyword, it means that the query return contains user-defined queries and variables.

For example:

select '%UserDefinedQueryName.UserDefinedVariableName%' || i.indexname
from...

These user-defined variables will be evaluated by separate queries defined by the user.

The following graphic illustrates the process of variable evaluation during reverse engineering:


Note   ReversedQueries
Extended queries should not be defined in the ReversedQueries item.

Step1

A query is executed to evaluate variables in a set of string statements.

If variables contain user-defined queries and user-defined variables, the user-defined query is executed to evaluate the user-defined variables. These user-defined variables are created to be filled with data proceeding from columns with LONG/BLOB/TEXT... data type.

You can create user-defined queries in any ODBC reverse engineering query. Make sure you use the same variable name in these queries and in the user-defined queries, otherwise the variables will not be evaluated.

You should also check for variable name uniqueness if you want all the variables to be evaluated during the execution of the query.

The header of a user-defined query contains internal variables names that will not be evaluated. However, the translation rules for values expressed between brackets (like (0="", *=",")) may be used during the string concatenation.

Step 2

The execution of the user-defined query must generate a numbered resultset containing as many pairs of user-defined variable name (without %) and variable value as needed, if there are many variables to evaluate.

For example, in the following resultset, the query returned 3 rows and 4 columns by row:

Variable 1 1 Variable 2 2
Variable 3 3 Variable 4 4
Variable 5 5 Variable 6 6

Step 3

The user-defined variable names are replaced by their values.

The following sections explain user-defined queries defined to address reverse engineering limitations.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.