Chatta subito con l'assistenza
Chat con il supporto

SQL Navigator for Oracle 7.6 - User Guide

Quick Overview Working With SQL Navigator Navigation Oracle Logon Code Editor Visual Object Editors Team Coding and Version Control Systems Modules, Windows And Dialogs
Analyze Tool Auto Describe Tool Benchmark Factory Bookmarks Dialog Capture Web Output Change Logon Password Dialog Code Analysis Code Assistant Code Road Map Code Templates Code Test Database Source Code Search Dialog DB Navigator Describe Difference Viewer Edit Data ER Diagram Explain Plan Tool Export Table Find and Replace Dialog Find objects Dialog Find Recycle Bin Objects Dialog Formatting Options HTML Viewer Import HTML as PL/SQL Import Table Java Manager Job Scheduler Locate In Tree Output Window PL/SQL Profiler Profile Manager Project Manager Publish Java to PL/SQL Quick Browse Rename Object Search Knowledge Xpert Select DB Object Dialog Server Output Server Side Installation Wizard Session Browser Source Preview SQL Modeler SQL Optimizer Task Manager Web Support Configuration Dialog Wrap Code
View | Preferences About Us

Code Analysis Window

The Code Analysis window provides detailed analysis, including a results dashboard, report, and tree view with violations and code properties. You can also simultaneously analyze multiple files from this window.

Note: This feature is available in the Professional Edition and higher.

To perform detailed code analysis

  1. Click Tools | Code Analysis.
  2. Load files or objects to analyze.

    Open files.

    Load objects from the database. You can click the drop-down arrow beside this button to load all objects or choose a group of objects to load.

  3. Select the rule set you want to use in the Code Analysis toolbar (the default is Top 20).

  4. To evaluate statements' complexity and validity, select Run SQL Scan in the Run Review list on the Code Analysis toolbar.

  5. Select the items to analyze in the grid.

    Use SHIFT or CTRL to select multiple items.

  6. Analyze code for all selected items. Click or press F9. (Ensure Run Review is selected.)

    Alternatively, to apply your selection to all items press F5.

  7. Review the Code Analysis results.

    Send code back to the Code Editor from the selected file or object. SQL Navigator displays the Code Analysis errors and violations in the tabs below the Code Editor.

 

Additional details

Grid Dashboard

The right side of the grid displays a dashboard of violations and statistics. The dashboard includes the item's Toad Code Rating (TCR), which is a composite of several rating criteria. The score ranges from 1 (best) to 4 (worst). It provides a quick reference for how your code has performed in the analysis.

Result tab

The Results tab displays the analysis results in a tree view. Expand each node for details on the violations. If you select a violation in the tree view, the preview on the right displays the corresponding code.

The Result tab displays the results for the item selected in the grid. If you analyzed multiple items and select them in the grid, the tab displays the results for all of the selected items.

Note: Click in the Code Analysis toolbar to view an icon legend.

Report tab

The Reports tab summarizes the analysis results and includes rule definitions. Items in the table of contents are hyperlinked so you can easily navigate the report.

Note: By default, the Report tab only displays the analysis for one item. However, you can select Display all selected results on Report tab to include multiple items in the report.

Code Analysis Rule Sets

A rule set is a collection of rules that Code Analysis uses to evaluate code. You can create your own rule set and determine which rules to include. You can also import existing rule sets from outside SQL Navigator, and export user-defined rule sets.

 

  1. From the Tools Menu, click Tools | Code Analysis.
  2. From the Code Analysis toolbar, click .

 

Create and Edit

Icon Description

Edit the selected rule set.

Note: You cannot edit SQL Navigator's standard rule sets.

Create a rule set
Use the selected rule set as your template

For each rule in the rule set, select the rule to include it, deselect the rule to exclude it.

 

Import and Export

Icon Description

Import a rule set. Navigate to the location of the rule set and click Open.

If the rule set has user defined rules then when importing you will be asked if a rule-export file exists, and you want to import it. If so the rules are imported. If any rule numbering has to occur because of conflicts, the rule set is automatically updated to the new rule numbers.

Export a user-defined rule set.

If the rule set has user defined rules then when exporting you will be asked if you want to export those user-defined rules with the rule set. If so the rules are saved as RuleExport.XML in the same directory as the exported rule set.

Code Analysis Rules

You can use existing Code Analysis rules or clone them and customize them to confirm your code meets your code review requirements. you can import and export rules.

 

  1. From the Tools Menu, click Tools | Code Analysis.
  2. From the Code Analysis toolbar, click .

 

Create or Clone

Icon Description The Code Analysis Rule Builder

Create a rule

Rule IDs are automatically generated sequentially from 7000 to 9000.

Enter the Description and specify the Rule Tip.

  • Specify Rule Severity, Rule Objective, and Rule Category.

  • Click to display the XML that SQL Navigator generates. This is helpful for use in an external XPath parser such as SketchPath to refine the XPath expression.

  • Create the XPath Expression. To test the rule, click .

Clone the selected rule

A checked box in the User Defined column will be displayed for the rule you created.

 

Edit

Select the rule to edit. Edit the fields as necessary.

Field Description
Code Preview Enter code to use for testing the rule.

XPath Expression

Edit the XPath. If this field is blank, then you cannot edit the XPath for the rule.

To test the rule, click .

To restore a rule or all rules, you can select the rule and click the 'Restore Original Rule Value' button, or the double-arrow 'Restore All Original Rule Values' button.

 

Import and Export

Icon Description

Import a rule. Navigate to the location of the rule and click Open.

Note:

  • If a modified SQL Navigator rule is imported, the changes are applied to the rule in place.
  • If a user-defined rule has a number that already exists, the imported rule is given the next available rule number and added.

Export the selected user-defined rule.

Code Assistant

Drag and drop PL/SQL syntax, SQL functions, column names, and database object names into code.

 

Move a code snippet into the editor

  1. Click View Menu | Code Assistant.
  2. Click the cursor in the editor where you would like the snippet inserted.
  3. Select the code snippet in Code Assistant. Double click on the code snippet or drag it into the editor.

 

Locate a code snippet in the Code Assistant

Code Snippets are stored in catalogs. The catalogs are as follows.

Catalog Description
Syntax and Web Catalog Browse the ready-to-use library of PL/SQL syntax. The Knowledge Xpert gives SQL Navigator users a library of more than 900 pre-built PL/SQL routines that can eliminate hours of low-level coding and debugging while enhancing application performance and reliability.
PL/Vision Catalog Knowledge Xpert products are available as optional add-on modules. For more information, see Search Knowledge Xpert.

Code and SQL Catalog

Store your own frequently used SQL statements and code fragments here.

For example, you can store your frequently-used cursor declarations or variable declarations.

TIP: The catalog sorts the folders and items alphabetically by name. Use your own naming conventions or prefixes to group similar snippets together.

Syn- IF THEN ELSIF …

Syn- WHERE clause …

Syn- SQL - Correlated subquery

Etc.

 

The Code Assistant Toolbar

Icon Tool Tip Description

Add new item or node

Add a code snippet or SQL statement. Open the Add to Catalog / Edit Dialog.

Edit item or node

Edit the selected item. Open the Add to Catalog / Edit Dialog.

Note:

  • To quickly rename an item: select it in the catalog then click on it.
  • You cannot rename the top level folders in the tree.

Delete item or node

Delete the selected item.

Note: You cannot delete the top level nodes of the tree.

Paste snippet into editor

Use to paste a code snippet into an editor:

  1. Click the cursor in the editor where you would like the snippet inserted.
  2. Click Paste snippet into editor.

TIP: Alternatively drag and drop the snippet into the editor.

Show information window

Show/Hide the information pane.

The information pane shows detailed information on the selected item.

Capture code

Use to add a code snippet or SQL statement from an editor window into the catalog:

  1. Select the code in the editor window.
  2. Click Capture Code.

This opens the Add to Catalog / Edit Dialog with the selected code already inserted.

Save all catalogs to disk

Save changes.

Related Documents

The document was helpful.

Seleziona valutazione

I easily found the information I needed.

Seleziona valutazione