SQL Bookmarks

DbVisualizer Logo
DbVisualizer 4.0.3 (Free and Personal editions)
January 2004
http://www.dbvis.com
support@dbvis.com


[ Master documentation index ]

Introduction

The SQL Bookmark feature was one of the original ideas when DbVisualizer was first designed. The background is that most SQL tools offer quite good support to edit and test SQL statements. But when the final optimized and really awesome SQL is complete then you're all alone. (We used to use a standard text editor and the famous copy/paste capability to transfer SQL's from and to SQL*Plus ;-)  )

The key concept behind 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 will pass the actual SQL along with the connection data to the SQL Commander. It is then the SQL commander that is used 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.
The bookmark management is primarily used to save SQL statements that are used often or for whatever reason there might be. There are different types of bookmarks and DbVisualizer automatically creates bookmarks in the following function areas:
(Read more about this in the following sections).

The Bookmarks Main Menu

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

Figure: The Bookmark main menu

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

Menu Choice
Description
Bookmark Editor
Requests to display the Bookmark Editor.
Add Bookmark to Folder
This is composed of 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 used to replace the chosen SQL bookmark with the SQL and connection data that is in the current SQL Commander editor. The replace bookmark menu consists of the root folders and last in the menu possibly the name of the last SQL bookmark that was passed from the bookmarks editor. 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 except that it is used to fetch the chosen SQL Bookmark and insert it into the current SQL Commander editor.

Bookmark Editor

The bookmark editor is the core of the bookmark management and is used to organize SQL bookmarks in folders and to do various adjustments.

Bookmark list

The editor is based on 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 that are in that root folder).

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.

The tree of folders and SQL bookmarks is contains 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. If a SQL bookmark was created by some other function in DbVisualizer then the name will be the first 40 characters of the SQL statement.
Database Connection
The database connection column when clicked displays a list of all defined database connections. The list indicates whether a connection is established or closed. It is here you specify using another database connection for an SQL bookmark.
Catalog
This column lists the Catalog (aka Database) that was current when the bookmark was created. You can change the Catalog by clicking in it. A list of accessible catalogs is then displayed.

Note:
The list of catalogs is empty if the Database Connection is not established.
Monitor
Check this box to enable the SQL bookmark to become a monitor and thereby appear in the Monitor main tab. SQL's 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

The note field can be used to write a short note about the SQL Bookmark. This note will appear as a tool tip 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 it is the SQL Commander that is used to execute SQL's. Select the Edit->Pass SQL to SQL Commander 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 then select the  last entry in the Bookmarks menu:

 

Figure: The Bookmark->Replace sub menu

If the last entry displays "No current bookmark" then it indicates that the currently edited SQL was not passed from the Bookmark Editor. You can use the other menu choices to locate the actual bookmark that will be replaced.

The Pass SQL to SQL Commander operation can also operate on a folder. Doing this will result in a script of all direct child SQL bookmarks that are located in that folder. Each of the SQL statements will be delimited by the delimiter as specified in Tool Properties.

Figure: Selecting a folder for execution

Once the Pass SQL to SQL Commander is selected the following will appear in the SQL Commander editor:

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 © 2004 Minq Software AB. All rights reserved.