The next field shown in the screenshot is only visible when working with macros, described in the KLART ULF Editing SQL Scripts section.
Next comes the Auto Commit Status field, showing whether Auto Commit is enabled.
The last two fields show information about the file loaded in the editor, if any. First the character encoding and then the filename. If you just type into the editor without loading a file, the filename "Untitled" is shown instead. An asterisk after the filename indicates that there are unsaved edits.
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, Open, Save 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.
Loading and Saving Bookmarks and Monitors
Bookmarks and Monitors are also files, but with special meaning. See the KLAR ULF 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 KLART 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.
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
The Find operation, by default mapped to the Find key and Ctrl-F key stroke, can not be recorded. You must instead use Find Selection, Find with Dialog, Find Next and Find Previous. Mouse gestures are also not recorded, only key strokes and menu selections.
Folding Selected Text
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
To do this in the SQL editor, click the mouse where you want to start the selection and then press the Alt key while you extend the selection by dragging the mouse.
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.
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.