Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The next field shown in the screenshot is only visible when working with macros, described in the ULF Editing SQL ScriptsRecording and Playing Edit Macros section.

Next comes the Auto Commit Status field, showing whether Auto Commit is enabled.

...

The SQL Editor is like any editor you're used to when it comes to typing, scrolling etc. But it also offers additional features to help you specifically with editing SQL scripts. These are described in the following sections.

Syntax Color Coding

An SQL script consists of keywords, operators, object identifiers, quoted text, etc. It may also contain comments. To make it easier to see at a glance what is what, the SQL Editor displays words using different font styles depending on their classification. For instance, keywords are displayed with a bold blue font, while quoted text is displayed with a regular type red font.

...

The editor uses the Tool Properties settings from the SQL Commander/Comments category under the General tab to detect comments.

Charsets and Fonts

You can also change the SQL Editor font family, which is useful and necessary in order to display characters for languages like Chinese, Japanese, etc., in Tool Properties in the Appearance/Fonts category to set the font for the SQL Editor. 

Loading and Saving Scripts

The SQL editor supports loading statements from a file and saving the content of the editor to a file. Use the standard file operations, OpenSave and Save As in the File main menu or the main toolbar to accomplish this. Loading a file loads it into a new SQL Commander tab or activates the tab that already holds it. 

...

You can also use the Quick File Open feature to open recent files as well as Bookmarks and History entries. By default, it is bound to the Ctrl+Alt+O key combination, and is also available via a main toolbar button as well as in the main File->Quick File Open menu.

Drag and Drop a File

You can also select a file in the platform's file browser and drop it somewhere in the DbVisualizer window. If you drop it in an editor, the file content is inserted at the caret position in the editor. If you instead drop it in the toolbar area, the file is opened in a new SQL Commander tab.

Drag and Drop Database Objects

If you want to include an object shown in the database objects tree, you can select the node and drop it in the editor where you want it inserted. The Script Object dialog is shown where you can select exactly what you want to insert in the editor.

...

Include Page
_ScriptObjectProperties
_ScriptObjectProperties

Loading and Saving Bookmarks and Monitors

Bookmarks and Monitors are also files, but with special meaning. See the Managing Frequently Used SQL for how to create and edit them in the SQL Editor.

Navigating Between History Entries

When you execute a script, DbVisualizer saves it as a history entry, see the Re-Executing SQL Statements section for details. You can use the Previous and Next buttons in the editor toolbar to navigate between (load) these entries.

Confirming Overwriting Unsaved Changes

By default, you have to confirm overwriting unsaved changes in an editor, e.g. when navigating between history entries, and when closing an SQL Commander tab with unsaved edits. You can disable these confirmation popups in the Tool Properties dialog, under the SQL Commander category under the General tab.

SQL Formatting

Include Page
_SQL_Formatting
_SQL_Formatting

Auto Completion

Include Page
_OnlyInPro
_OnlyInPro

Index term
secondaryauto complete
primarySQL statement
Auto completion is a convenient feature used to assist you when editing SQL statements and DbVisualizer commands.  By default, you activate auto completion with the key binding Ctrl-SPACE, but you can also configure it to activate as you type (in the Tool Properties dialog, in the SQL Editor/Auto Completion category under the General tab).

With the caret in any place in a statement where you can type something other than a table name or a column name, and at least one character just before the caret, activating auto completion displays a list of keywords that starts with the letters you have typed so far. As you continue to type, the list narrows.

...

Note

If there are several SQL statements in the editor then , make sure to separate them using the statement delimiter character (the default to is ";").

In order for the column name completion pop-up to appear, you must first make sure there are table names in the statement.

All table names that has have been listed in the completion pop-up are cached by DbVisualizer to make sure subsequent displays of the pop-up is performed quickly without asking the database. The cache is cleared only when doing a Refresh in the database objects tree or reconnecting the database connection.

The Database and Schema lists above the editor is are used to assist the auto completion feature to limit which tables to list in the pop-up.limit the list of tables in the auto complete pop-up to those in the selected database and/or schema. To include all tables, select the blank entries in these lists. The default selections for the lists can be set as connection properties, in the SQL Commander category.

It is possible to fine-tune how auto completion shall work works in the connection properties.

...

Sorting, when to show the popup, etc. can be configured in the Tool Properties dialog, in the SQL Editor/Auto Completion category under the General tab.

Recording and Playing Edit Macros

Index term
secondaryedit
tertiaryusing macros
primaryscript
If you repeatedly need to run a sequence of edit operation, you can record them as a macro and play it as many times as needed during an editing session. The editor status bar indicates when a recording is in progress and when a macro is available to play.

...

Note

The Find operation, by default mapped to the Find key and Ctrl-F key stroke, can not be recorded. You must instead use Find SelectionFind with DialogFind Next and Find Previous. Mouse gestures are also not recorded, only key strokes and menu selections.

Folding Selected Text

Index term
secondaryedit
tertiaryfolding text
primaryscript
If you work with a large script, it can sometimes be helpful to hide parts of it. You can do so using the Code Folding feature.

...

You can fold more than one part of a script using the same procedure.

To unfold just one part, select the folding marker (be careful to select all of it) and then choose Toggle Fold Selection from the menu again. To unfold all folded parts, use Expand All Foldings.

Selecting a Rectangular Area

Index term
secondaryedit
tertiaryselect rectangular area
primaryscript
In some cases, it is handy to be able to select a rectangular area in the middle of a script. Say, for instance, that you need to copy just the first part of a few lines and paste it at the beginning of some other lines.

To do this in the SQL editor, click the mouse where you want to start the selection and then press the Alt key (by default) while you extend the selection by dragging the mouse. If you prefer to use  the Ctrl key as the modifier, you can change the default in Tool Properties in the SQL Commander category under the General tab.

Tab Key Treatment

Pressing the TAB key in the editor inserts four space characters by default. If you instead want a TAB character to be inserted, or want to insert another number of space characters, you can specify this in the Tool Properties dialog, in the SQL Commander category under the General tab.

Key Bindings

The editor shortcuts, or key bindings, can be redefined in the Tool Properties dialog, in the Key Bindings category under the General tab. Expand the Editor Commands node to manage all editor actions and the Main Menu/Edit node to manage the key bindings for the edit operations in the right-click editor menu and the main window Edit menu.