Chapter 2 Physical Data Model Basics


Previewing SQL statements

The Preview page shows an SQL query script before it is generated. The displayed script reflects the options selected in the Database Generation dialog box. This script cannot be modified.

For more information on database generation options, see the Generating a Database from a PDM chapter.

The text in the script preview is color coded as follows:

Text color Represents
Blue SQL reserved word
Black Statement body
Red Variable
Green Comment

You can use the following tools and keyboard shortcuts from the Preview toolbar:

Tool Description Keyboard shortcut

Editor contextual menu Shift + F11

Refresh F5

This tool is available when at least one extended model definition flagged for generation is linked to the model and when it contains GeneratedFiles entries for the current object. When available, it displays the list of targets for the current object. If you add a generation target, the corresponding tab is added to the Preview page. If you deselect a generation target, the corresponding tab disappears from the Preview page Ctrl + F6

Show generation options Ctrl + W

Ignore generation options Ctrl + D

For more information on extended model definitions used for generation, see chapter Extended Model Definitions Reference Guide in the Advanced User documentation .

Changing generation options

If you click the Change Generation Options tool, the Generation Options dialog box appears. You can change generation options and preview their effect on the code.

Ignore generation options

If you click the Ignore Generation Options tool, the preview ignores generation options selected by using the Change generation options tool but uses a predefined set of options.


Selected tool
Effect on generation options
Effect on preview
Change generation options You can select generation options Visible in Preview if options are applicable
Ignore generation options Generation options currently selected are overridden by predefined set of options Only predefined options are visible in Preview
Change generation options + Ignore generation options You can select generation options Changes ignored in Preview

The predefined set of generation options selects these items:

Generation Option Tab Selected items
Tables and Views All items except drop options
Keys and Indexes All items except options represented differently in some DBMS. For example, if a database is auto indexed, the index options corresponding to the keys are not selected
Database All items except drop options
Options All user-defined options are used

SQL script bookmarks

In the SQL Editor or SQL Preview page, you can add and remove bookmarks at specific points in the SQL script and then navigate forwards or backwards from bookmark to bookmark:

Keyboard shortcut Description
Ctrl + F2 Adds a new bookmark. A blue bookmark box appears. If you repeat this action from the same position, the bookmark is deleted and the blue marker disappears
F2 Jumps to next bookmark
Shift + F2 Jumps to the previous bookmark

Note that bookmarks are not printable and are lost if you use the Refresh, Change Generation or Ignore Generation options.

Steps To preview the code of a table:

  1. Double-click a table in the diagram to display the table property sheet.
  2. Click the Preview tab to display the Preview page.
  3. Click OK.

 


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