SQL Bookmarks

DbVisualizer Logo
DbVisualizer 6.5
October 2008
http://www.dbvis.com
support@dbvis.com


[ Master documentation index ]

Introduction

The purpose with the bookmark management is to offer a way to save SQL statements between invocations of DbVisualizer and make it easy to execute them. Another important requirement is to organize SQL statements in folders for structural and grouping purposes. The core of the bookmark management is the Bookmark Editor. It is here the bookmarks are organized.

The bookmark editor depends heavily on the SQL Commander, since, when requesting to execute an SQL Bookmark, the Bookmark Editor passes the SQL statement along with the connection data to the SQL Commander. You then use the SQL commander to edit and test the SQL until it is complete.

What's a bookmark in DbVisualizer?

An SQL Bookmark is generally an SQL statement that is saved between invocations of DbVisualizer. In addition, it also keeps related information needed to execute the SQL and present the result accordingly once it is requested.
There are different types of bookmarks. DbVisualizer automatically creates bookmarks in the following function areas:
You can also create SQL Bookmarks manually in the Bookmark Editor, as well as from SQL in the SQL Commander with the operations available in the Bookmarks menu. The following sections describes this in more detail.

The Bookmarks Main Menu

The bookmarks main menu in the DbVisualizer window contains the following choices:


Figure: The Bookmark main menu

All menu choices except the Bookmark Editor choice are disabled if you are not in the SQL Commander tab.

Menu Choice Description
Bookmark Editor... Start the Bookmark Editor
Add Bookmark to Folder This choice has a sub menu in which all folders are displayed. This list displays the paths for all folders (i.e the folder hierarchy from the root). The root folders are Personal, New or History (read more about these in the sections below). Once a folder has been selected the following dialog is displayed. Here you can change the default name and add an optional note.


 
Replace Bookmark This option is usedto replace the chosen SQL bookmark with the SQL and connection data that is in the current SQL Commander editor. The Replace Bookmark sub menu consists of the root folders and, as the last menu entry, the name of the last SQL bookmark that was passed from the Bookmarks Editor, if any. If you want to replace the data for that SQL Bookmark just select its name in the menu.


 
Get Bookmark Get Bookmark shows the same menu hierarchy as Replace Bookmark, but works in the reverse direction; it fetches the chosen SQL Bookmark and inserts it into the current SQL Commander editor.
Execute Bookmark Same as Get Bookmark but this one also executes the SQL statement(s)

Bookmark Editor

The Bookmark Editor is at the core of the bookmark management, used for organization of SQL Bookmarks in folders and to do various adjustments.

Bookmark list

The editor presents the bookmarks in a tree list with the same structure as the tree that appears in the Bookmarks main menu options. The tree has three root folders that cannot be changed, moved or removed. There is basically no difference between these root folders except that they are used in different contexts in DbVisualizer.
(The number after the root folder names indicates the number of SQL bookmarks the root folder contains).


Figure: The Bookmark Editor

You cannot create folders or SQL bookmarks in the New or History root folders. The way to work with these folders is to copy the SQL Bookmarks you want from them into the appropriate location in the Personal root folder.

For each SQL Bookmark, the tree holds the following information:

Column in list Description
Name The name of the node (folder or SQL bookmark). Modify the name by selecting the column and click once to get into editor mode. The Edit->Change Name menu choice can be used for the same purpose. When an SQL Bookmark is created by DbVisualizer, the default name is the first 40 characters of the SQL statement.
Database Connection Double-clicking on the Database Connection column displays a list of all defined database connections. The list indicates whether a connection is established or closed. You can choose a connection in the list if you want to use another database connection for an SQL Bookmark.
Catalog This column lists the catalog (aka database) that was selected when the bookmark was created. You can change the catalog by double-clicking on the name and pick another from a list of accessible catalogs.
Note:
Schema The schema that was selected when the bookmark was created. You can change it in the same was as you change the catalog.
Monitor Check this box to enable the SQL Bookmark to be used as a monitor and thereby appear in the Monitor main tab. SQL statements that returns results are the most obvious candidates for being monitored.
Contain Variables This column is read only and indicates whether the SQL statement includes any DbVisualizer variables. (I.e ${variable name}$)
Multi SQL This column is also read only and indicates whether the SQL statement is composed of several SQL statements (aka script). This is determined by looking for statement delimiters in the SQL.

New and History root folders

The number of SQL bookmarks that may be added by DbVisualizer to the New and History root folders are specified in the Tool Properties->Bookmarks category. Bookmarks in these folders can be removed one by one or each folder can be cleared using the File->Clear all New entries or File->Clear all History entries.

SQL Editor

Monitor information

The monitor sub tab controls the total number of rows that will be kept in the result grid until rows are automatically removed. This feature is specific to the monitor feature. Please see Charts and Monitors for more information.

The Note field

You can use the note field to write a short description of the SQL Bookmark. This note appears as a tooltip in the Bookmarks main menu.

Executing an SQL bookmark or folder of SQL bookmarks

The SQL editor in the bookmark editor can be used to modify the SQL but it is not the place to execute SQL statements. Instead, you use pass the bookmark to the SQL Commander execute it there. Select the Edit->Copy to SQL Commander or Edit->Execute Bookmark menu operation to copy the selected SQL bookmark into the SQL Commander. The SQL Commander is then used to execute and edit the SQL. Once you are satisfied with it, you can select the last entry in the Bookmarks menu save the edits:

 

Figure: The Bookmark->Replace sub menu

If the last entry displays "No current bookmark," it indicates that the currently edited SQL was not passed from the Bookmark Editor. You can use the other menu choices to locate the bookmark to replace or save it as a new bookmark.

The Copy to SQL Commander and Execute Bookmark operations also operate on a folder. In this case, a script is created from all direct child SQL Bookmarks that are located in that folder. Each SQL statement is delimited by the delimiter as specified in Tool Properties.

Figure: Selecting a folder for execution

As an example, choosing the Copy to SQL Commander for a folder of bookmarks may result in the following statements being added in the SQL Commander:

Figure: The SQL Commander editor

Note that the Database Connection and Catalog lists are empty. You need to select these from the lists when a script of SQL bookmarks is passed from the Bookmark Editor.


Copyright © 2008 Onseven Software AB. All rights reserved.