20.7 Using Procedural Code View
Any SQL developer who programs stored procedures or functions or simply anyone who writes SQL code using SELECT from a database view frequently needs to pick at the source code of the referenced object to learn the business logic encapsulated in that object. Typical methods to peek at the code involve using of Procedure Editor, Event Editor and so on. Such utilities require many mouse clicks to find and reach the needed object. This is a very time consuming process, especially when working with large systems containing many thousands of objects.
SQL Assistant
TM supports an elegant single click method to lookup the required code without a need to go anywhere outside of the target Editor window. This method is based on the so-called ''hot mouse tracking'' feature. Hot tracking is the visual effect whereby the text under the mouse pointer reacts to pointer movement and turns into a hyperlink. To activate that feature, hold down the Ctrl key and then move the mouse pointer over the name of the object whose source code you want to preview. The object name under the pointer will turn to a hyperlink. Click the hyperlink to display the Procedural Code View window (Fig.
20.20) with the source code of the clicked object.
Figure 20.20:
Procedural Code View.
|
|
SQL Assistant
TM supports an additional methods for invoking Procedural Code View:
- Highlight the word or simply click on the words referring to a procedural object or view in the database then right click and select the SQL Assistant (TM) / Show Procedure Code item.
Note: The Show Procedure Code menu can be used with procedural objects of different types including:
- Views
- Stored Procedures and Stored Functions
- User defined functions
20.7.1 Navigating Code Views
The previous topic describes how to invoke the Procedural Code View window when this view is not open. You can use the same methods to view code of a different procedural object while the Code View window is already open. Every time you invoke Code View, the view content is automatically refreshed with the source code of the newly requested object. The Code View window keeps track of requested objects and allows you to navigate their codes much like you navigate pages in a web browser. Use yellow arrows in the top-right corner of the Procedural Code View window to navigate displayed screens.
The navigation history is only available while the Procedural Code View window is open. If you close it and then invoke the Procedural Code View again, the previous navigation history gets lost.
Tip:
You can use the same invocation methods with the Procedural Code View window methods to lookup source code of the objects whose names are mentioned in the displayed code. This way you can drill-down from source code of a top level procedure to source other of objects called within that object code (Fig.
20.21). The navigation buttons in the top-right corner can be used to go back to the source code of the previously viewed object.
Figure 20.21:
Procedural Code View: drilling.
|
|
20.7.2 Scrolling Content
Use standard scroll bars available in the Code View window to scroll the contents.
20.7.3 Resizing Content
To resize the Code View window, drag the top-edge the window up or down. Note that when you place mouse pointer over the top edge of the Code View window the cursor shape changes to resize shape. Make sure the cursor takes the right shape before dragging the window edge.
20.7.4 Copying Content
The Code View window supports 'copy to the Clipboard' function that can be used to copy the entire content or highlighted portions of the content only. Use ''copy'' icon to copy the text. Note that if no text is highlighted in the Procedural Code View, the entire content is copied, otherwise only the
highlighted text is copied to the Clipboard. The copied text can be then pasted into the Editor or
any other program using standard Ctrl+V hot key.
Copyright © 2007 - 2009 HoneySoftware - All Rights Reserved
Submit feedback on this topic.