Previous Topic: ISCPersistenceUnit::Save ArgumentsNext Topic: ISCPersistenceUnit::ForwardEngineer


ISCPersistenceUnit::ReverseEngineer

Here is the signature for the ReverseEngineer function:

HRESULT ReverseEngineer ([in]ISCPropertyBag * PropertyBag,[in]VARIANT REoptionpath,[in] VARIANT REConnectionString,[in] VARIANT REPassword);

The following table contains the valid arguments for the ReverseEngineer function:

Parameter

Valid Type/Value

Description

PropertyBag

ISCPropertyBag * – Pointer to a Property Bag object.

Contains options for reverse engineering.

 

REoptionpath

VT_BSTR – Path.

Specifies the full path to the items storage for reverse engineering.

REConnectionString

VT_BSTR – Database connection string.

Identifies the database connect string.

REPassword

VT_BSTR – Connection password.

Null for windows authentication.

Identifies the password used for database connection.

The following table contains the valid arguments for the PropertyBag parameter.

Parameter

Valid Type/Value

Description

System_objects

VT_BOOL -- True or False.

Default: False

Retrieves system objects.

True: System objects are retrieved.

False: System objects are not retrieved.

Oracle_Use_DBA_Views

VT_BOOL – True or False

Default: False. Only valid for Oracle.

Use DBA Views for reverse engineering.

True: Use DBA Views.

False: Do not use DBA Views.

Synch_Table_Filter_By_Name

VT_BSTR

Default: Null

Reverse engineers the tables that contain the input filter strings.Multiple filter strings are specified as comma separated values.

Synch_Owned_Only

VT_BOOL – True or False.

Default: False

 

Retrieves tables and views of users.

True: Retrieve from current user or owners.

False: Retrieve from all.

Synch_Owned_Only_Name

VT_BSTR

Default: Null

Reverse engineers tables and views owned by the specified users.

Case_Option

25090:None

25091:lower

25092:Upper

Default: None

Specifies the case conversion option for physical names.

Logical_Case_Option

25045: None

25046: UPPER

25047: lower

25048:Mixed

Default: None

Specifies the case conversion option for logical names.

Infer_Primary_Keys

VT_BOOL– True or False.

Default: None

Infers primary key columns for the tables that are based on defined indexes.

True: Primary Keys option is selected.

False: Primary Keys option is not selected.

Infer_Relations

VT_BOOL– True or False.

Default: False

Infers the relationships between tables that are based on either primary key column names or defined indexes.

True: Relations Option is selected.

False: Relations Option is not selected.

Infer_Relations_Indexes

VT_BOOL– True or False.

Note: Set the value to Indexes or Names when Infer_Relations is set to Relations.

Default: False.

Infers the relationships from the table indexes.

True: Indexes option is selected.

False: Names option is selected.

Remove_ERwin_Generated_Triggers

VT_BOOL—True or False.

Default: True.

Removes ERwin generated triggers.

True: Remove Include Generated Triggers.

False: Do not remove Include Generated Triggers.

Force_Physical_Name_Option

VT_BOOL—True or False.

Default: Force

Overrides the physical name property for all objects in logical/physical models automatically during reverse engineering.

True: Force physical name option.

False: Do not force physical name option.

Connection String

Server=<Target Server type>:<MajorVersion>:<MinorVersion>
|AUTHENTICATION=<AuthenticationType>|USER=<UserName>|<ServerParameter>=<ServerParameterValue>

Example:

SERVER=16:10:0|AUTHENTICATION=4|USER=erwin|1=3|2=r8|3=127.0.0.1\\erwin_mart01

The following table describes the valid values for a connection string.

Parameter

Value

Description

SERVER

<TargetServerType> is an integer value.

1: Access

2: DB2

3: DB2UDB

4: Foxpro

5: Inforrmix

6: Ingres

7: ISeries

8: MySQL

9: ODBC

10: Oracle

11: Progress

12: Redbrick

13: SAS

14: Sybase

15: SybaseIQ

16: SQLServer

17: Teradata

18: SQLAzure

Specifies the type of the database server.

AUTHENTICATION

4 or 8

4: Database authentication

8: Windows authentication

Specifies the authentication type.

User

User Name

Specifies the user name.

The following table describes the type and value of ServerParameter:

Server Parameter

Server Parameter Value

Description

1

2 or 3

2: Indicates "Use ODBC data source".

3: Indicates "Use Native Connection"

2

String

Identifies the database.

3

String

Identifies the server name.

4

String

Identifies the alternate catalog name.

5

String

Identifies the ODBC data source name.

6

String

Identifies the connection string for the database.

7

String

Identifies the access database path.

8

String

Identifies the system database path.

9

String

Identifies the password for access system database.

10

Boolean 0 or 1

0: ODBC data browse is turned off.

1: ODBC data browse is turned on.

11

Boolean 0 or 1

0: Do not use encrypted connection.

1: Use encrypted connection.

12

Boolean 0 or 1

0: Do not connect to Oracle as SYSDBA.

1: Connect to Oracle as SYSDBA.

Reverse Engineering Sample Script:

Dim oAPI
    	Set oAPI = CreateObject("ERwin9.SCAPI.9.0")

        Dim oPropertyBag
	Set oPropertyBag = CreateObject("ERwin9.SCAPI.PropertyBag.9.0")

        Call oPropertyBag.Add("Model_Type", "Combined")
        Call oPropertyBag.Add("Target_Server", 1075859016)
        Call oPropertyBag.Add("Target_Server_Version", 10)

        Dim oPUnitCol
        Set oPUnitCol = oApi.PersistenceUnits

        Dim oPersistenceUnit
        Set oPersistenceUnit = oPUnitCol.Create(oPropertyBag)

        'oPropertyBag = CreateObject("ERwin9.SCAPI.PropertyBag.9.0")
        'oPropertyBag = oApi.ApplicationEnvironment.PropertyBag
        oPropertyBag.ClearAll()
        Call oPropertyBag.Add("System_Objects", True)
        Call oPropertyBag.Add("Oracle_Use_DBA_Views", False)
        Call oPropertyBag.Add("Synch_Owned_Only", False)
        Call oPropertyBag.Add("Synch_Owned_Only_Name", "")
        Call oPropertyBag.Add("Case_Option", 25091)
        Call oPropertyBag.Add("Logical_Case_Option", 25046)
        Call oPropertyBag.Add("Infer_Primary_Keys", False)
        Call oPropertyBag.Add("Infer_Relations", False)
        Call oPropertyBag.Add("Infer_Relations_Indexes", False)
        Call oPropertyBag.Add("Remove_ERwin_Generated_Triggers", False)
        Call oPropertyBag.Add("Force_Physical_Name_Option", False)
	Call oPropertyBag.Add("Synch_Table_Filter_By_Name", "")

        Call oPersistenceUnit.ReverseEngineer(oPropertyBag, "c:\\re.xml", "SERVER=16:10:0|AUTHENTICATION=4|USER=erwin|1=3|2=r8|3=127.0.0.1\\erwin_mart01", "ca123456")
Call oPersistenceUnit.Save("c:\\test.erwin", "OVF=Yes")