This tutorial shows how to setup a Visual Expert Project including both PB + DB code (Oracle, SQL Server…). It includes 3 main steps:
- Add your PB code
- Add your DB code
- Configure the VE project to analyze PB to DB dependencies thoroughly
Before starting, please check the following requirements:
- Update your installation with the latest Visual Expert build.
- Include only 1 set of PB code in your VE project (a PB target, OR a set of files/folders containing the PB code).
- Include only 1 set of DB code in your VE project (by connecting to the DB, OR selecting files/folders containing the DB code).
Please note: you can include several PB applications in a single VE project; however you cannot include DB code as well. VE will not be able to analyze PB to DB dependencies properly with multiple PB applications.
Step1 – Adding PB code
- Open the Project Wizard: [file – New Project]
- Select “PowerBuilder” > choose your version of PowerBuilder
- Include your PB code using either “Target” or “folders/files”
- Once your PB code is selected, click “Next”
- Select “Add more code in your VE project”. This will take you back to the code selection pages.
Step 2 – Adding DB Code
- Choose your database:
- You can include code by connecting to either the DB or selecting file/folders.
If you choose the First option, you can filter DB objects from your database:
you may not want to analyze all system objects, functions, tables, etc. but only your own code.
Filtering by DB owner is usually a good start:
- Once your DB code is selected, click “next” > select “Continue Setup”
- Name your VE project
- Set the scheduler to refresh your analysis automatically
- Select “Open Project Setup”
Step 3: Configure the project to thoroughly analyze PB to DB dependencies
Why this step?
Consider the following SQLs:
Select firstname, lastname from employee Select firstname, lastname from myschema.employee
This basic example creates ambiguity:
By default, Visual Expert cannot know whether employee and myschema.employee refer to the same table. Unless we remove this ambiguity, Visual Expert will duplicate the table employee.
To avoid this issue, VE needs a default DB schema:
In the example above, if VE knows that myschema is the default schema, then implicitly employee is the same as myschema.employee, and the table employee will not be duplicated in the VE project.
- Open the tab “Project – Source Code Location” (screenshot)
- Select the first item in the table – click on “Default DB Items” – enter the name of the default Server, Database and Schema.
- Select the second item in the table (second language) - click on “Default DB Items” – enter the name of the default Server, Database and Schema.
Important note: it is key to specify these settings for both types of code (PB and DB). They rely on 2 separate code parsers, both of them should connect the DB Objects referenced to the right schema.
- Click OK, close the settings window and launch the code analysis as prompted by VE.
- After the analysis is completed, you should see objects based on each languages included in the project. For instance: