Plug-in Framework

DbVisualizer Logo
DbVisualizer 4.3
January 2006
http://www.dbvis.com
support@dbvis.com


[ Master documentation index ]

Introduction

Note: The plug-in framework is supported only by the DbVisualizer Personal edition.

This document explains the database profile concept which is the base for how DbVisualizer presents information in the Database Objects tree and in the Object View. The document is targeted for advanced users needing to create or modify database profiles.

What features in DbVisualizer are affected by a database profile?

Key features in DbVisualizer are the database objects tree used to navigate the database and the object view showing details about a database object. The general problem exploring databases that can be connected via DbVisualizer is that they are all different with respect to the information describing whats in the database (also called system tables or database meta data). This briefly means that it's rather complex for a tool such as DbVisualizer since each database must be explored specifically at the implementation level. (JDBC offers a generic toolkit that can be used but its level of support is very limited).

The database profile concept was introduced to ease the process of defining what information DbVisualizer will display for each database. A database profile is an XML document stored in a file which makes it extremely easy to modify what information should be presented in DbVisualizer. No programming is necessary! DbVisualizer comes with a collection of different object viewers that can be used depending on how object data should be presented. Creating or modifying database profiles requires no technical knowledge other then the basics in XML.

All database profiles are loaded from the DBVIS-HOME/resources/profiles directory.

The following figure illustrates what in the DbVisualizer user interface that is handled by the database profile.


Figure: Database Objects tab

The red box at the left shows the database objects tree. This tree is used to navigate the structure and contained objects in the database. Selecting an object in the tree will show the object view (blue box) specifically for the selected object type. An object view may have several data views with object information. DbVisualizer show these as labeled tabs. The green box shows in this screen shot the content of the data view labeled Columns. The type of viewer that is presenting the data in the screen shot is the grid viewer. Read more about data viewers in the Viewers section.

Common for both the database objects tree and the object view are the SQL commands that are used to fetch the information from the database. The associated SQL is executed by DbVisualizer whenever a node in the tree is expanded (to find out any child objects) or when a node is selected to fill the object data views.

How does DbVisualizer pick the correct database profile?

The way DbVisualizer determine what XML file to load is based on a couple of parameters:

The default behavior is that DbVisualizer auto detects what profile to use as follows:
  1. When the database connection has been established DbVisualizer also knows what kind of database and JDBC driver that is being used.
  2. The information about the database connection is now matched with the information in the database-mappings.xml file.
  3. If there is a matching profile then it will be used.
  4. If there is no matching entry then a generic profile will be used. (This is solely based on what JDBC offers).
A database connection can in addition be defined to always use a specific profile. This is specified in the database connection properties feature. Manually choosing a profile requires that the profile supports the actual database. If it doesn't then various errors will be reported once the database objects tree is explored. (Whenever a profile is manually selected must the actual database connection be re-started).

The name of the loaded profile is listed in the Connection tab status bar once the connection has been established.


Figure: The status bar in the Connection tab

XML structure

The mapping from the visual components in the user interface described earlier and the element definitions in the XML file is briefly as follows:
The XML for a database profile is quite simple but there are a few things that must be highlighted. All database connections loads a database profile from an XML file. If there is no matching database profile then a generic profile will be used. This profile uses the standard JDBC meta data calls in order to obtain information about the structure and objects in the database. The generic profile is not one XML file as specialized profiles but actually three files:
All these three files a referred in the generic.xml file as include statements i.e each of the above files will be included in the generic.xml file. The reason for this is that all of these files can be included and extended in a specialized profile. See later for more information.

The XML structure used to represent the database profile is organized as follows (in order):

XML skeleton

The following is a minimal XML file showing the key structure.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE DatabaseProfile SYSTEM "dbvis-defs.dtd" [
<!ENTITY generic-commands SYSTEM
"generic-commands.xml">
<!ENTITY generic-view SYSTEM
"generic-view.xml">
]>


<
DatabaseProfile
name=
"sybase-ase"
desc=
"Profile for Sybase ASE"
version=
"$Revision: 1.7 $"
date=
"$Date: 2005/09/21 15:00:07 $">

<!-- =================================================================== -->

<!-- Definition of the commands -->

<!-- =================================================================== -->


<
Commands>
&generic-commands;
...
</Commands>

<!-- =================================================================== -->

<!-- Definition of the database objects tree structure -->

<!-- =================================================================== -->


<ObjectsTreeDef id="sybase-ase">
...
</
ObjectsTreeDef>

<!-- =================================================================== -->

<!-- Definition of the database objects views -->

<!-- =================================================================== -->


<!-- Include the generic-view -->
&generic-view;


<
ObjectsViewDef id="sybase-ase" extends="generic">
...
</
ObjectsViewDef>

</
DatabaseProfile>

Note: The name of the XML file (sybase-ase) and the values for the name attribute for the DatabaseProfile, ObjectsTreeDef and ObjectsViewDef elements must be the same

The first rows in the XML defines external dependencies and their URI's. The DOCTYPE identifier defines the DTD that is used to verify the XML with. The ENTITY identifiers lists URI's for external references. In this case they identify the generic-commands.xml and generic-view.xml files. They can then be referred in the XML as either &generic-commands; and &generic-view; and simply means that the accompanying XML files will be included in the XML.

The root of the database profile is the <DatabaseProfile> element. Continue to the next sections for information about the elements forming the database profile.

XML Elements

The following section describes the key XML elements and their attributes.

<DatabaseProfile>

The <DatabaseProfile> is the root element in the XML file. It is required and have the following attributes.

<DatabaseProfile
desc="Profile for Sybase ASE"
version=
"$Revision: 1.7 $"
date=
"$Date: 2005/09/21 15:00:07 $">

...

</
DatabaseProfile>

All attributes are required. They will appear in the Database Profile list when selecting the properties for a database connection:


Figure: The list of available database profiles

<Commands>

This element keeps all <Command> child elements each describing the SQL and its interface. Each <Command> element is identified by a unique id which is referred in the ObjectsTreeDef and in the ObjectsViewDef definitions.

<Commands>
&generic-commands;

 <Command>
  ...

 </Command>

</
Commands>

The first statement in the <Commands> element is:

    &generic-commands;

This simply means that the generic-commands entity defined at the top of the XML file will be included in the XML i.e all its definitions will be accessible as is.

<Command>

The <Command> element identifies everything needed for DbVisualizer to execute the SQL associated with the command. The SQL must return a result set with 0 or several rows i.e statements that doesn't return any result set is currently not supported. The following command queries for login information in Sybase ASE.

<Command id="sybase-ase.getLogins">
<
SQL>
<![CDATA[
select name, suid, dbname, fullname, language, totcpu,
totio, pwdate from master.dbo.syslogins
]]>
</
SQL>
</
Command>

The id for this command is sybase-ase.getLogins. The reason for prefixing the id with the name of the profile is for maintainability. Since the generic-commands.xml file is included in most profiles it is easier to set unique prefixes for all commands so that they are not mixed with the the commands in the generic-commands.xml file.
Result set
The result set for the previous query looks as follows:

name
suid
dbname fullname language
totcpu
totio pwdate
sa
1
master (null)
(null)
0
0 2005-02-24 23:59:14
probe 2 subsystemdb (null) (null) 0 0 2005-02-25 00:01:15

The way DbVisualizer handles the result set depends on whether the command is executed as a request in the database objects tree (ObjectsTreeDef) or in the object view (ObjectsViewDef). If executed in the database objects tree then each row in the result set will be a new node in the tree. If executed in the object view then it is the actual viewer component that decides how the result will be presented. For more information how a result set is used in either the ObjectsTreeDef and ObjectsViewDef read the specific sections.

Another important difference between the database objects tree and object view is that the tree is a hierarchical structure of objects while object view presents information about a specific object. An object that is inserted in the database objects tree is a 1..1 mapping with a row from the actual result set. The end user will see these objects (nodes) by some descriptive name as defined in the ObjectsTreeDef. However, all data for the row in the original result set is stored with the object in the tree. This is not the case in the ObjectViewDef.

The following example put some light on this. Consider the previous result set and that it is used to create objects in the database objects tree. The end user will see the following in DbVisualizer. The visible name for each row is the name column in the result set.


Figure: Sample of the Logins node having two child nodes

Each of the sa and probe nodes have all their respective data from the result set associated with the nodes. The data is referenced as commandId.columnName i.e sybase-ase.getLogins.name, sybase-ase.getLogins.dbname, etc. The complete structure for the sa node then looks as follows:

sybase-ase.getLogins.name = sa
sybase-ase.getLogins.suid = 1
sybase-ase.getLogins.dbname = master
sybase-ase.getLogins.fullname = (null)
sybase-ase.getLogins.language = (null)
sybase-ase.getLogins.totcpu = 0
sybase-ase.getLogins.totio = 0
sybase-ase.getLogins.pwdate = 2005-02-24 23:59:14

<Input> - Setting input data 
There are two types of Commands: with or without dynamic input. The difference is that dynamic input Commands accepts input data that is typically used to form the WHERE clause in the SQL. The previous example illustrates a static SQL (without dynamic data).

To allow for dynamic input just add the <Input> element as a child to the Command. The SQL must also be modified to contain variables at the positions in the statement that should get dynamic values. The following is an extension to the previous example allowing for dynamic input.

<Command id="sybase-ase.getLogins">
<
SQL>
<![CDATA[
select name, suid, dbname, fullname, language, totcpu,
totio, pwdate from master.dbo.syslogins
where name = '${name}'
and suid = '${suid}'
]]>
</
SQL>
<Input>
<Column name="name" value="sa">
<Column name="suid" value="${sybase-ase.getProcesses.suid}">
</Input>
</Command>

The previous example adds two input variables: name and suid. The value for the first name input column is set to "sa".

<Column name="name" value="sa">

There is no magic with this definition since the ${name} variable in the SQL will be replaced with "sa". (This variable is defined as an example. In a real profile it is better to remove it since it's static and insert the value into the SQL).

The second input column definition introduces that variables can be set as value.

<Column name="suid" value="${sybase-ase.getProcesses.suid}">

The value for the suid definition will in this case get the value of the sybase-ase.getProcesses.suid when the SQL is executed. So where is this variable defined? As explained in the Result Set section we introduced how all the data for a row in the result set is associated with the objects in the database objects tree. In addition can a command reference information in parent object using the very same variable syntax. So the variable ${sybase-ase.getProcesses.suid} simply means that DbVisualizer will look through the parental tree structure and pick the first matching entry and use its value.
<Output> - Re-defining the output
As mentioned earlier is a specific column value in a result set row referenced by the name of the column. Sometimes this is not desirable and the <Output> definition can be used to change this. The following simply identifies a column in the result set by its index number starting from 1 and then force its name to be set as the value of the id attribute.
<Output>
<Column id="sybase-ase.getLogins.Name" index="1">
<Column id="sybase-ase.getLogins.suid" index="2">
</Output>

Another option using the <Output> element is to alter the columns in the result set by either adding, renaming or removing them.

<Output>
<Column modelaction="add" index="THIS_IS_A_NEW_COLUMN" value="Rattle and Hum">
<Column modelaction="rename" index="ADDR" name="ADDRESS">
<Column modelaction="rename" index="2" name="PHONE">
<Column modelaction="drop" index="MOBILE_PHONE">
<Column modelaction="drop" index="4">
</Output>

(The rename and drop actions accepts either the name of the column or index number starting from left with 1).

The add operation is used to add a new column to all rows. The value attribute accepts variables using the ${...} syntax.
The rename operation simply renames a column.
The drop operation drops the specified column.

The rename operation is primarily used when building a custom command that is supposed to be used by a viewer that requires a certain input by column names. Read more in the <ObjectsViewDef> section.

<ObjectsTreeDef> - Definition of the Database Objects Tree

The ObjectsTreeDef controls how the database objects tree will be presented and what commands that are used to form its content. The mapping between the ObejctsTreeDef and the visual appearance in DbVisualizer is very easily mapped:
 

<ObjectsTreeDef id="sybase-ase">
<
GroupNode type="Databases">
<
DataNode type="Catalog">
<
GroupNode type="Tables">
<
DataNode type="Table"/>
</
GroupNode>
<
GroupNode type="SystemTables">
<
DataNode type="SystemTable"/>
</
GroupNode>
<
GroupNode type="Views">
<
DataNode type="View"/>
</
GroupNode>
<
GroupNode type="Users"/>
<
GroupNode type="Groups">
<
DataNode type="Group"/>
</
GroupNode>
<
GroupNode type="Types"/>
<
GroupNode type="Triggers">
<
DataNode type="Trigger"/>
</
GroupNode>
<
GroupNode type="Procedures">
<
DataNode type="Procedure"/>
</
GroupNode>
</
DataNode>
</
GroupNode>

<
GroupNode type="DBA">
<
GroupNode type="ServerInfo"/>
<
GroupNode type="Logins">
<
DataNode type="Login"/>
</
GroupNode>
<
GroupNode type="Devices">
<
DataNode type="Device"/>
</
GroupNode>
<
GroupNode type="RemoteServers"/>
<
GroupNode type="Processes"/>
<
GroupNode type="ServerRoles">
<
DataNode type="ServerRole"/>
</
GroupNode>
<
GroupNode type="Transactions"/>
<
GroupNode type="Locks"/>
</
GroupNode>
</
ObjectsTreeDef>

Figure: The visual database objects tree and its XML definition

The screen shots shows all nodes representing the <GroupNode> definitions in the ObjectsTreeDef. One exception is the Logins object that has been expanded to illustrate how <DataNode> objects look. The ObjectsTreeDef in the example above has been simplified to only show the type attribute. (The label of the nodes as they appear in the visual tree is not listed in the ObjectsTreeDef example) The type attribute is primarily used internally in the profile as an identifier between the ObjectsTreeDef and the ObjectsViewDef. The type is also visible in the DbVisualizer GUI when either the tool tip for a tree node is displayed and in the object view header. The type is also used to identify what icon that will be used to represent the object.

There are no limitation on the number of levels in the ObjectsTreeDef. A good rule is however to keep it simple and intuitive.

<GroupNode>

The <GroupNode> element is used to represent a static object in the tree and cannot execute any commands. It is primarily used for structural and grouping purposes. The GroupNode element have the following attributes.

<GroupNode type="SystemTables" label="System Tables" isLeaf="false">
...
</GroupNode>

The isLeaf attribute is optional and controls whether the GroupNode may have any child objects or not. It can always be set to true but the effect in the visual database objects tree is then that the expand icon to the left of the group node icon will always be displayed even though it can never have any child objects. The default setting for isLeaf is false.

<DataNode>

The <DataNode> element feeds the tree with dynamic data produced by Commands. The example in the <Command> section querying for all logins look as follow in the ObjectsTreeDef:

<GroupNode type="Logins" label="Logins">
<DataNode type="Login" label="${sybase-ase.getLogins.Name}" isLeaf="true">
<Command idref="sybase-ase.getLogins"/>
</DataNode>
</GroupNode>

First there is a <GroupNode> element with the purpose to group all child objects.
The <DataNode> have in this example the same attributes as the <GroupNode>, the type is however "Login" instead of "Logins" as for the <GroupNode>. This difference is important once the user click on either of the objects so that the Object View will show the appropriate views. The <DataNode> definition can be seen as a template as the associated command will fetch rows of data from the database and DbVisualizer will use the <DataNode> definition to create one node per row in the result set.

The label attribute for the data node is somewhat different as it introduces the use of a variable. The real value for the label will in this example be the value in the Name column produced by the sybase-ase.getLogins command as you can see in the <Command> definition (the name of the variables have the same prefix as the commands).

The <Command> element defines by an idref attribute what command that should be used to create the objects in the tree. The command in this case and in the Result set section produced a result set with 2 rows and 8 columns. The result will then be that two nodes will be created each with the label of the Name column in the result set.


Figure: Sample of the Logins node having two child nodes

The label can be changed by setting it to any other variable or a composition with several variables:

label="${sybase-ase.getLogins.Name} (${sybase-ase.getLogins.dbname})"

Will result in following being displayed:

sa (system)
probe (subsystemdb)

The complete set of attributes for the <DataNode> element is as follows:

<DataNode type="value"              - The type of node (required)
label="value" - The visual label (required)
isLeaf="true/false" - Specifies if the node can have child objects (default true)
sort="col1,col2" - A comma separated list of names/variables used for sorting
 drop-label-not-equal=
"value"
- Do not add the node if the label is not equal to this value
stop-label-hot-equal="value" - The node will be a leaf if label don't match this value
is-empty-output="continue/stop"/> - If result set it empty then use this to control whether child
GroupNode/DataNodes should be added anyway or ignored

The <Command> definition in this example is the common way of referencing commands i.e only by its name using the idref attribute. There are however situations when additional data must be set in the <Command> specifically for a <DataNode>. Continue reading the next section for details.
<Command>
The common way commands are referenced in the <DataNode> definition is by its id as the idref attribute. Sometimes its is required that a specific <DataNode> must supply for example different input to a command. This is done by simply adding the standard <Input> element to the <Command>.

<DataNode type="Login" label="${sybase-ase.getLogins.Name}" isLeaf="true">
<Command idref="sybase-ase.getLogins"/>
<Input>
<Column name="name" value="sa">
<Column name="suid" value="${sybase-ase.getProcesses.suid}">
</Input>
</DataNode>

If the <Command> in the <Commands> section have any <Input> element defined then this is overridden if specifying the <Input> element in the <DataNode> definition.

The value of any variables in the <Input> element will be searched based on the strategy described in the Result set section.
<Filter>
The <Filter> element is specific for <Commands> that appear in the <DatabaseObjectsTree> structure. A filter definition simply defines what columns for a <DataNode> that are allowed to use in filters. These filters are more known as Database Objects Tree Filtering in DbVisualizer and appear below the database objects tree. The following example shows that filtering may be defined for these types:
For each of these <Filter> definitions are one or several columns defined that can be used to filter on.


Figure: Screen shot showing the filter pane

<DataNode type="Views" label="${sybase-ase.getViews.Name}" isLeaf="true">
<Command idref="sybase-ase.getViews">
<Filter type="View" name="View Table">
<Column index="TABLE_NAME" name="Name"/>
</Filter>
</Command>
</DataNode>

The filter definition above specifies that the type of object the filter is for is View. The name specifies what the name of the tab in the filter pane will be. The <Column> element(s) then defined the index which should be either a column name in the result set or an index number representing the actual column. The name attribute then specifies the name of the column as it will appear in the filter pane.

Several columns may be specified in the Filter element.
<SetVar>
The <SetVar> element is used to assist DbVisualizer so that it can work properly. There are 3 main object types that DbVisualizer relies on:
For these object types you need to define with the <SetVar> element that it is a catalog, schema or table. The value should be the label of the appropriate object.

<DataNode type="Views" label="${sybase-ase.getViews.Name}" isLeaf="true">
<SetVar name="schema" value="${getTables.TABLES_SCHEM}">
<SetVar name="table" value="${getTables.TABLES_NAME}">
<SetVar name="rowcount" value="true/false">
</DataNode>

The reason these <SetVar> elements are defined for the Views type in sybase-ase profile are that  schemas are not expressed in the <ObjectsTreeDef>. The schema information is however available by the command that is executed. The TABLES_SCHEM value is simply fetched from the result set and then set as schema using the <SetVar> element. The same applies for the table setting.
(catalog is set by a parent <DataNode> so it is not needed here).

The rowcount setting control whether the object supports getting row count with select count(*).

<ObjectsViewDef> - Definition of the Object View

The <ObjectsViewDef> element defines all objects views that will appear when selecting a node in the database objects tree. The object type information between the  <ObjectsTreeDef> and the <ObjectsViewDef> are the same and makes it easy to map what viewers should appear for a specific object type.

When an object is selected in the tree (sa in the screen shot below) its complete information is passed to the object view handler (right in the screen shot). This handler determines based on the object type what object view will present the information. Once found all data views are created as tabs in the user interface. The selected object and its information is passed to each of the data views for processing and presentation. The following shows how the Object View look in DbVisualizer and its accompanying <ObjectView> definitions.


<ObjectView type="Logins">
<
DataView type="Logins" label="Logins" viewer="grid">
<
Command idref="sybase-ase.getLogins"/>
</
DataView>
</
ObjectView>

<
ObjectView type="Login">
<
DataView type="Info" label="Info" viewer="node-form"/>
<
DataView type="Databases" label="Databases" viewer="grid">
<
Command idref="sybase-ase.getLoginDatabases"/>
</
DataView>
<
DataView type="Roles" label="Roles" viewer="grid">
<
Command idref="sybase-ase.getLoginRoles"/>
</
DataView>
</
ObjectView>

Figure: The visual database objects tree, object view and its XML definition

The screen shot shows both the Logins node and its child nodes, sa and probe. What is not obvious in the screen shot is the object types of these objects. The Logins node is of type Logins while the child nodes are of type Login.

The <ObjectView> definition above shows the views for two types, Logins and Login. Clicking on the node labeled Logins in the tree will show the object view for the <ObjectView type="Logins"> definition while clicking on the nodes labeled sa or probe will show the object view for the <ObjectView type="Login"> .

The example shows sa being selected. Its <DataView> definitions are (by label):
These views are presented in DbVisualizer as tabs. The label of each tab is the label defined in the <DataView> and the icons are defined by respective object type.

The <ObjectsViewDef> element has the following attributes

<!-- Include the generic-view --> 
&generic-view;

<ObjectsViewDef id="Views" extends="generic" >
...
</ObjectsViewDef>

The first statement in the <Commands> element is:

    &generic-view;

This simply means that the generic-view entity defined at the top of the XML file will be included in the XML i.e all its definitions will be accessible as is. An example is the <ObjectView> definition in the generic-view.xml file for the Table object type. It contains a lot of <DataView> elements that identifies all viewers for the Table. If you now want to use the generic Table <DataView's> but add a new Abbreviations <DataView> then simply extend the generic Table <DataView>. This is briefly done by adding the extends="generic" attribute in the <ObjectsViewDef> element. Then by using the exact same object type in the extending <ObjectView> you will get this behavior. Read more about extending <ObjectView's> in the Extending <ObjectView> section.

<ObjectView>

The <ObjectView> element is identified by an object type and groups all <DataView> elements that will appear when the object type is selected in the database objects tree. Here follows the <ObjectView> definition for the Login object type.

<ObjectView type="Login">
...
</ObjectView>

This element is simple as its only attribute is the type. The type is used when a node is clicked in the database objects tree to map the object of the type clicked and its <ObjectView>.

<DataView>

The <DataView> element is where the things happen. It defines how the viewer should be labeled in DbVisualizer, what viewer it should use, commands and some other things. The following is the <DataView> definitions for the Login object type. (The <ObjectView> element is part of the sample just for clarification).

<ObjectView type="Login">
<
DataView type="Info" label="Info" viewer="node-form"/>
<
DataView type="Databases" label="Databases" viewer="grid">
<
Command idref="sybase-ase.getLoginDatabases"/>
</
DataView>
<
DataView type="Roles" label="Roles" viewer="grid">
<
Command idref="sybase-ase.getLoginRoles"/>
</
DataView>
</
ObjectView>

This definition will be presented in DbVisualizer as described in the introduction of <ObjectsViewDef> section.  These three data view elements have the viewer attribute. It identifies how the data in the view will be presented. See next section for a list of supported viewers.
Viewers
DbVisualizer supports the following viewers:

Viewer name Require <Command>
child element
Description Optional attributes
grid Yes Presents a results set in a grid  
text Yes Presents one row column in a text editor column="columnName"
form Yes Presents the row(s) from a result set in a form. If several rows are in the result then those are presented in a list. Selecting one row from the list will present all its column in a form  
node-form No Presents all data from the original result set for the tree object in a form  
table-refs Yes Shows the references graph for the table object  
tables-refs Yes Shows the references graph for several tables in the result set  
table-data Yes Shows the table grid with editing features  
table-rowcount Yes Shows the row count for the table object  
<Command>
Please read in <Command> section earlier as its capabilities is the same here.
<Action>
Note: This element can be used only if the viewer attribute is grid for the <DataView> element.

The <Action> is used to define what additional actions should appear in the grid right click menu. These will only be enabled if there is at least one cell selected in the grid. The following is the <Action> elements that are currently supported. (<DataView> is in the sample for clarification).

<DataView>
<Action name="Script: SELECT ALL" template="SelectAllCommand">
<Map from="OWNER" to="schema"/>
<Map from="TABLE_NAME" to="table"/>
</Action>
<Action name="Script: DROP TABLE" template="DropTableCommand">
<Map from="OWNER" to="schema"/>
<Map from="TABLE_NAME" to="table"/>
</Action>
</DataView>

A <Map> element is used to map the original result set column and the name for it as used by the template.

Note: The current support for <Action> is somewhat limited as it is mapped only two SelectAllCommand and DropTableCommand. It is not possible to add more actions.
<Message>
The <Message> element is very simple as it defines a message that will appear at the top of the dataview tab (above the viewer). The definition is as follows:

<DataView type="Source" label="DDL" viewer="text">
<Command idref="oracle.getDDL"/>
<Message>
<![CDATA[
<html>
This view shows the complete DDL used to create the object.<br>
<b>Note: The DDL viewer requires at least Oracle 9i and later versions.</b>
</html>
]]>
</Message>
</DataView>

It can be used to further explain the content in the viewer.
Extending <ObjectView>
An existing <ObjectView> definition made in for example the generic-view.xml file can be extended in a database profile by using a few action attributes for each of the <DataView> elements. To accomplish extensions the object type specified in the <ObjectView> type attribute must match the type in the parent profile. Now you have the following options:

Conditional processing

(From DbVisualizer 4.3.4)

Conditional processing briefly means that a profile can adjust its content based on conditions. A few examples:
Conditional processing is especially useful to adopt the profile for different versions of the database (and/or JDBC driver). Up to DbVisualizer 4.3.3 was a profile tested with a "minimum" of a database version. Accessing for example an Oracle 8 database using the Oracle profile supplied with DbVisualizer works most of the time but fails is some situations since it require at least Oracle 9. Another advantage with the conditional processing is to replace generic error messages with more user friendly messages.

Programmers familiar with if, else if and else will easily learn the conditional elements.

Depending on which of the two phases the conditions should be processed some restrictions and rules apply. Please read the following sections for more information.

When conditions are processed

There are two phases when conditions are processed:
  1. Conditional processing when database connection is established
    <If>, <ElseIf> and <Else> elements can be specified almost everywhere in the profile.
  2. Conditional processing during command execution
    The <OnError> element is used to define a message that will appear in DbVisualizer if a command fail. To control what message should appear conditions are used.
DbVisualizer determines what <If> elements should be executed in what phase by the type attribute. If this attribute has the value type="runtime" then it will be processed in the second phase. If it is not specified or set to type="load" if will be processed in the first phase.

Conditional processing when database connection is established

The following example shows the use of conditions that will be processed during connect of the database connection.

<Command id="sybase-ase.getLogins">
<If test="#DatabaseMetaData.getDatabaseMajorVersion() lte 8">
<SQL>
<![CDATA[
select name from master.dbo.syslogins
]]>
</SQL>
</If>
<ElseIf test="#DatabaseMetaData.getDatabaseMajorVersion() eq 9">
<SQL>
<![CDATA[
select name, suid from master.dbo.syslogins
]]>
</SQL>
</ElseIf>
<Else>
<SQL>
<![CDATA[
select name, suid, dbname from master.dbo.syslogins
]]>
</SQL>
</Else>
</Command>

The above briefly means that if the major version of the database being accessed is less then or equal to 8 the first SQL will be used. If the version is equal to 9 then the second SQL is used, the last SQL will be used for all other version. The test attribute may contain conditions that are AND'ed or OR'ed. Conditions can contain multiple evaluations combined using paranthesis.
The <If>, <ElseIf> and <Else> elements may be placed anywhere in the XML file.

Here is another example that controls whether certain nodes will appear in the database objects tree or not.

<!-- Getting Table Engines was added in MySQL 4.1 --> 
<If test="(#dm.getDatabaseMajorVersion() eq 4 and #dm.getDatabaseMinorVersion() gte 1)
or #dm.getDatabaseMajorVersion() gte 5"
>
<GroupNode type="TableEngines" label="Table Engines" isLeaf="true"/>

<!-- Errors was added in MySQL 5 -->
<If test="#dm.getDatabaseMajorVersion() gte 5">
<GroupNode type="Errors" label="Errors" isLeaf="true"/>
</If>
</If>

As you can see this example contains nested uses of <If>.

Conditional processing during command execution

Using conditional processing to evaluate any errors from a Command may be useful to re-phrase error messages to be more user friendly.

<Commands> 
<OnError>
<!-- The ORA-942 error means "the table or view doesn't exist" -->
<!-- It is catched here since these errors typically indicates -->
<!-- that the user don't have privileges to access the SYS and/or -->
<!-- V$ tables. -->
<If test="#result.getErrorCode() eq 942" context="runtime">
<Message>
<![CDATA[

You don't have the required privileges to view this object.
]]>
</Message>
</If>
<ElseIf test="#result.getErrorCode() eq 17008" context="runtime">
<Message>
<![CDATA[

Your connection with the database server has been interrupted!
Please <a href="connect" action="connect">reconnect</a> to re-establish the connection.
]]>
</Message>
</ElseIf>
</OnError>

...

</Commands>

The <OnError> element can be used in <Commands> and <Command> elements. If used in <Commands> element its conditions will be processed for all commands. If it is part of a specific <Command> it will be processed only for that command.

Mapping a database connection with a specific database profile

The default strategy for how DbVisualizer loads a database profile for a database connection is by auto detecting it. This is accomplished by the database-mappings.xml file located in the DBVIS-HOME/resources directory. The file is organized as follows. (The sample lists only two DatabaseMappings for the Sybase ASE and Sybase ASE):

<DbVisualizer>
<DatabaseMappings>
<DatabaseMapping>
<If test="#DatabaseMetaData.getURL().matches('^jdbc:sybase.*') and
#DatabaseMetaData.getDatabaseProductName().matches('^adaptive server enterprise.*')"/>
<Run expr="#me.setProfile('sybase-ase')/>
<Run expr="#me.setFacade('com.onseven.dbvis.sql.facade.SybaseASEFacade')"/>
<Run expr="#ConnectionProperties.setProperty('TableNamePrefix', '[')"/>
<Run expr="#ConnectionProperties.setProperty('TableNameSuffix', ']')"/>
<Run expr="#ConnectionProperties.setProperty('DatabaseColumnPrefix', '[')"/>
<Run expr="#ConnectionProperties.setProperty('DatabaseColumnSuffix', ']')"/>
</If>
 </DatabaseMapping>

<DatabaseMapping>
<If test="#DatabaseMetaData.getURL().matches('^jdbc:sybase.*') and
#DatabaseMetaData.getDatabaseProductName().matches('^adaptive server anywhere.*')"/>
<Run expr="#me.setFacade('com.onseven.dbvis.sql.facade.SybaseASAFacade')"/>
</If>
</DatabaseMapping>
</DatabaseMappings>
</DbVisualizer

Each <DatabaseMapping> element identifies the rules for one specific database type. The <If> element specifies the conditions that should be tested while the <Run> elements specifies what should be done when the conditions are met.

Conditions can be matched using <If> with values from three different contexts. The full name that should be matched is composed of the context name a dot (".") and then a method name. Example. #DatabaseMetaData.getURL(). These are the support contexts:
The <If> element and its test attribute should be composed of a statement that gets information from any of the contexts and then code that is used to evaluate the information. The example earlier shows how the DatabaseMetaData.getURL() method is called. The result is then matched with the regular expression ^jdbc:sybase.* that simply means that the condition will be satisfied if the URL starts with jdbc:sybase. The test attribute may contain several expressions separated with AND and OR keywords.
(Read about regular expressions at  http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html).

The <Run> element identifies what should be done once the <If> test is satisfied. The expr attribute in the <Run> element supports the following contexts:
If DbVisualizer finds a matching <DatabaseMapping> then it will load it and ignore any following <DatabaseMapping> elements.
If no matching <DatabaseMapping> is found then the generic profile and generic facade will be used.

Current restrictions

Complete XML example

This is the complete XML file for the MySQL database profile. It is in comparison with other profiles quite small. The reason for this is that MySQL is limited in the number of objects it supports (ex tables, users, processes, etc). Oracle, DB2 and SQL Server does on the other hand support a myriad of objects which results in bigger XML files.

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE DatabaseProfile SYSTEM "dbvis-defs.dtd" [
<!ENTITY generic-commands SYSTEM
"generic-commands.xml">
<!ENTITY generic-view SYSTEM
"generic-view.xml">
]>


<!--
Copyright (c) 2004 Onseven Software AB. All Rights Reserved.
-->


<DatabaseProfile
name="sybase-ase"
desc="Profile for Sybase ASE"
version="$Revision: 1.7 $"
date="$Date: 2005/09/21 15:00:07 $">

<!-- =================================================================== -->
<!-- Definition of the commands -->
<!-- =================================================================== -->

<Commands>

&generic-commands;

<Command id="sybase-ase.getObjects">
<SQL>
<![CDATA[

select owner = user_name(uid), name, crdate "Creation Date"
from ${database}.dbo.sysobjects where type = '${type}' order by name
]]>
</SQL>
<Input>
<Column name="database" value=""/>
<Column name="type" value=""/>
</Input>
</Command>

<Command id="sybase-ase.getObjectSource">
<SQL>
<![CDATA[

select text from ${database}.dbo.syscomments c, ${database}.dbo.sysobjects s
where s.id = c.id and s.name = '${name}'
]]>
</SQL>
<Input>
<Column name="database" value=""/>
<Column name="owner" value=""/>
<Column name="name" value=""/>
</Input>
</Command>

<Command id="sybase-ase.getTriggers">
<SQL>
<![CDATA[

use ${database}
select 'name' = object_name(o.instrig),
'insert' 'type', 'owner' = user_name(o.uid), 'table' = object_name(o.id)
from ${database}.dbo.sysobjects o where o.type = 'U' and object_name(instrig) is not null
union
select 'name' = object_name(o.updtrig),
'update' 'type', 'owner' = user_name(o.uid), 'table' = object_name(o.id)
from ${database}.dbo.sysobjects o where o.type = 'U' and object_name(updtrig) is not null
union
select 'name' = object_name(o.deltrig),
'delete' 'type', 'owner' = user_name(o.uid), 'table' = object_name(o.id)
from ${database}.dbo.sysobjects o where o.type = 'U' and object_name(deltrig) is not null
]]>
</SQL>
<Input>
<Column name="database" value=""/>
<Column name="owner" value=""/>
</Input>
</Command>

<Command id="sybase-ase.getTableTriggers">
<SQL>
<![CDATA[

use ${database}
select name = object_name(o.instrig),
'insert' 'type', 'owner' = user_name(o.uid), 'table' = object_name(o.id), sc.text 'source'
from ${database}.dbo.sysobjects o, ${database}.dbo.syscomments sc
where o.instrig = sc.id and o.id = object_id('${name}') and object_name(instrig) is not null
union
select name = object_name(o.updtrig),
'update' 'type', 'owner' = user_name(o.uid), 'table' = object_name(o.id), sc.text 'source'
from ${database}.dbo.sysobjects o, ${database}.dbo.syscomments sc
where o.updtrig = sc.id and o.id = object_id('${name}') and object_name(updtrig) is not null
union
select name = object_name(o.deltrig),
'delete' 'type', 'owner' = user_name(o.uid), 'table' = object_name(o.id), sc.text 'source'
from ${database}.dbo.sysobjects o, ${database}.dbo.syscomments sc
where o.deltrig = sc.id and o.id = object_id('${name}') and object_name(deltrig) is not null
]]>
</SQL>
<Input>
<Column name="database" value=""/>
<Column name="owner" value=""/>
<Column name="name" value=""/>
</Input>
</Command>

<Command id="sybase-ase.getUsers">
<SQL>
<![CDATA[

${database}.dbo.sp_helpuser
]]>
</SQL>
<Input>
<Column name="database" value="${catalog}"/>
</Input>
</Command>

<Command id="sybase-ase.getGroups">
<SQL>
<![CDATA[

${database}.dbo.sp_helpgroup
]]>
</SQL>
<Input>
<Column name="database" value="${catalog}"/>
</Input>
<Output>
<Column id="sybase-ase.getGroups.Group_name" index="1"/>
</Output>
</Command>

<Command id="sybase-ase.getGroupUsers">
<SQL>
<![CDATA[

select a.name from ${database}.dbo.sysusers a, ${database}.dbo.sysusers b
where b.name = '${name}' and a.gid = b.gid and a.uid != a.gid and a.uid != 1
]]>
</SQL>
<Input>
<Column name="database" value="${catalog}"/>
<Column name="name" value="${sybase-ase.getGroups.Group_name}"/>
</Input>
</Command>

<Command id="sybase-ase.getUserTypes">
<SQL>
<![CDATA[

select t.name 'Data Type', p.name 'System Type', b.name 'Creator',
t.allownulls 'Allow Nulls', t.length 'Length', t.prec 'Precision', t.scale 'Scale'
from ${database}.dbo.systypes t, ${database}.dbo.sysusers b, ${database}.dbo.systypes p
where t.uid = b.uid and t.usertype >= 100 and t.type = p.type and p.usertype =
(select min(usertype) from ${database}.dbo.systypes where type = t.type)
]]>
</SQL>
<Input>
<Column name="database" value="${catalog}"/>
</Input>
</Command>

<!-- ================================================================= -->
<!-- DBA related commands requiring certain privileges in the database -->
<!-- ================================================================= -->

<Command id="sybase-ase.getLogins">
<SQL>
<![CDATA[

select name "Name", suid, dbname "Default Database", fullname "Full Name",
language "Default Language", totcpu "CPU Time", totio "I/O Time", pwdate "Password Set"
from master.dbo.syslogins
]]>
</SQL>
<Output>
<Column id="sybase-ase.getLogins.Name" index="1"/>
<Column id="sybase-ase.getLogins.suid" index="2"/>
</Output>
</Command>

<Command id="sybase-ase.getLoginDatabases">
<SQL>
<![CDATA[

select a.name "Name", sum(c.size / 512) "Size (MB)"
from master.dbo.sysdatabases a, master.dbo.syslogins b, master.dbo.sysusages c
where (a.suid = b.suid) and (b.suid = ${suid}) and a.dbid = c.dbid group by a.name
]]>
</SQL>
<Input>
<Column name="suid" value="${sybase-ase.getLogins.suid}"/>
</Input>
</Command>

<Command id="sybase-ase.getLoginRoles">
<SQL>
<![CDATA[

select role_name(lr.srid) "Name", lr.status "Status"
from master.dbo.sysloginroles lr, master.dbo.syslogins l
where lr.suid = l.suid and l.name = '${login}' and lr.status = 1
]]>
</SQL>
<Input>
<Column name="login" value="${sybase-ase.getLogins.Name}"/>
</Input>
</Command>

<Command id="sybase-ase.getServerRoles">
<SQL>
<![CDATA[

select * from master.dbo.syssrvroles
]]>
</SQL>
<Output>
<Column id="sybase-ase.getServerRoles.NAME" index="2"/>
</Output>
</Command>

<Command id="sybase-ase.getRoleLogins">
<SQL>
<![CDATA[

select l.name "Name", lr.status "Status"
from master.dbo.syslogins l, master.dbo.sysloginroles lr
where lr.srid = role_id('${name}') and l.suid = lr.suid and lr.status = 1
]]>
</SQL>
<Input>
<Column name="name" value="${sybase-ase.getServerRoles.NAME}"/>
</Input>
</Command>

<Command id="sybase-ase.getDevices">
<SQL>
<![CDATA[

select a.name "Name", a.phyname "Pysical Name",
(a.high - a.low + 1) / 512 "Size (MB)",
(select (a.high - a.low + 1) / 512 - (sum(size / 512) * (2048 / 2048))
from master.dbo.sysusages
where (vstart <= a.high) and (vstart >= a.low)) "Free (MB)"
from master.dbo.sysdevices a where (a.cntrltype = 0) group by a.name
]]>
</SQL>
<Output>
<Column id="sybase-ase.getDevices.Name" index="1"/>
</Output>
</Command>

<Command id="sybase-ase.getDeviceDatabases">
<SQL>
<![CDATA[

select a.name "Name", sum(b.size) / 512 "Size (MB)",
(select l.name from master.dbo.syslogins l where l.suid = a.suid) "Creator"
from master.dbo.sysdatabases a, master.dbo.sysusages b, master.dbo.sysdevices c
where (a.dbid = b.dbid) and (b.vstart <= c.high) and
(b.vstart >= c.low) and (c.name = '${name}') group by a.name
]]>
</SQL>
<Input>
<Column name="name" value="${sybase-ase.getDevices.Name}"/>
</Input>
</Command>

<Command id="sybase-ase.serverInfo">
<SQL>
<![CDATA[

exec sp_server_info
]]>
</SQL>
</Command>

<Command id="sybase-ase.getRemoteServers">
<SQL>
<![CDATA[

select s.srvid, s.srvname, s.srvnetname, s.srvclass, v.name
from master.dbo.sysservers s, master.dbo.spt_values v
where s.srvclass = v.number and v.type = 'X' and v.name not in ('access_server', 'sds')
order by s.srvname
]]>
</SQL>
</Command>

<Command id="sybase-ase.getCaches">
<SQL>
<![CDATA[

select a.name, a.status, a.value, (select b.value from master.dbo.syscurconfigs b
where b.config = a.config and b.comment = a.name)
from master.dbo.sysconfigures a where parent = 19 and config = parent order by 2
]]>
</SQL>
</Command>

<Command id="sybase-ase.getProcesses">
<SQL>
<![CDATA[

select p.spid, p.program_name, p.cmd, l.name, p.status, p.suid
from master.dbo.sysprocesses p, master.dbo.syslogins l
where p.suid *= l.suid order by 1
]]>
</SQL>
</Command>

<Command id="sybase-ase.getCharSet">
<SQL>
<![CDATA[

select name, description from master.dbo.syscharsets
where id = (select value from master.dbo.syscurconfigs where config = 131) ;
]]>
</SQL>
</Command>

<Command id="sybase-ase.getTransactions">
<SQL>
<![CDATA[

select type = convert(char(11),v3.name), coordinator = convert(char(10), v4.name),
starttime=convert(char(20), starttime), state = convert(char(17),v1.name),
connection = convert(char(9), v2.name), dbid=masterdbid, spid, loid, namelen, xactname
from master.dbo.systransactions ts, master.dbo.spt_values v1,
master.dbo.spt_values v2, master.dbo.spt_values v3, master.dbo.spt_values v4
where ts.state = v1.number and v1.type = 'T1' and ts.connection = v2.number and
v2.type = 'T2' and ts.type = v3.number and v3.type = 'T3'
and ts.coordinator = v4.number and v4.type = 'T4'
]]>
</SQL>
</Command>

<Command id="sybase-ase.getLocks">
<SQL>
<![CDATA[

select fid, spid, loid, locktype = v1.name, table_id = id, page, row,
dbname = db_name(dbid), class, context = v2.name
from master.dbo.syslocks l, master.dbo.spt_values v1, master.dbo.spt_values v2
where l.type = v1.number and v1.type = 'L' and (l.context + 2049) = v2.number and v2.type = 'L2'
]]>
</SQL>
</Command>


</Commands>

<!-- =================================================================== -->
<!-- Definition of the database objects tree structure -->
<!-- This definition do not list catalogs as these are not supported -->
<!-- by Oracle. -->
<!-- =================================================================== -->

<ObjectsTreeDef id="sybase-ase">
<GroupNode type="Databases" label="Databases">
<DataNode type="Catalog" label="${getCatalogs.TABLE_CAT}"
is-empty-output="continue">
<SetVar name="catalog" value="${getCatalogs.TABLE_CAT}"/>
<Command idref="getCatalogs">
<Filter type="Catalog" name="Catalog">
<Column index="TABLE_CAT" name="Name"/>
</Filter>
</Command>
<GroupNode type="Tables" label="Tables">
<DataNode type="Table" label="${getTables.TABLE_SCHEM}.${getTables.TABLE_NAME}" isLeaf="true">
<SetVar name="schema" value="${getTables.TABLE_SCHEM}"/>
<SetVar name="table" value="${getTables.TABLE_NAME}"/>
<SetVar name="rowcount" value="true"/>
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="tableType" value="TABLE"/>
</Input>
<Filter type="Table" name="Table">
<Column index="TABLE_NAME" name="Name"/>
</Filter>
</Command>
</DataNode>
</GroupNode>

<GroupNode type="SystemTables" label="System Tables">
<DataNode type="SystemTable" label="${getTables.TABLE_SCHEM}.${getTables.TABLE_NAME}" isLeaf="true">
<SetVar name="schema" value="${getTables.TABLE_SCHEM}"/>
<SetVar name="table" value="${getTables.TABLE_NAME}"/>
<SetVar name="rowcount" value="true"/>
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="tableType" value="SYSTEM TABLE"/>
</Input>
<Filter type="SystemTable" name="System Table">
<Column index="TABLE_NAME" name="Name"/>
</Filter>
</Command>
</DataNode>
</GroupNode>

<GroupNode type="Views" label="Views">
<DataNode type="View" label="${getTables.TABLE_SCHEM}.${getTables.TABLE_NAME}" isLeaf="true">
<SetVar name="schema" value="${getTables.TABLE_SCHEM}"/>
<SetVar name="table" value="${getTables.TABLE_NAME}"/>
<SetVar name="rowcount" value="true"/>
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="tableType" value="VIEW"/>
</Input>
<Filter type="View" name="View Table">
<Column index="TABLE_NAME" name="Name"/>
</Filter>
</Command>
</DataNode>
</GroupNode>

<GroupNode type="Users" label="Users" isLeaf="true"/>

<GroupNode type="Groups" label="Groups">
<DataNode type="Group" label="${sybase-ase.getGroups.Group_name}" isLeaf="true">
<Command idref="sybase-ase.getGroups"/>
</DataNode>
</GroupNode>

<GroupNode type="Types" label="User Defined Data Types" isLeaf="true"/>

<GroupNode type="Triggers" label="Triggers">
<DataNode type="Trigger" label="${sybase-ase.getTriggers.name} (${sybase-ase.getTriggers.owner}.${sybase-ase.getTriggers.table})" isLeaf="true">
<SetVar name="schemaName" value="${sybase-ase.getTriggers.owner}"/>
<Command idref="sybase-ase.getTriggers">
<Input>
<Column name="database" value="${catalog}"/>
</Input>
</Command>
</DataNode>
</GroupNode>

<GroupNode type="Procedures" label="Stored Procedures">
<DataNode type="Procedure" label="${sybase-ase.getObjects.owner}.${sybase-ase.getObjects.name}" isLeaf="true">
<SetVar name="schemaName" value="${sybase-ase.getObjects.owner}"/>
<SetVar name="procedureName" value="${sybase-ase.getObjects.name}"/>
<Command idref="sybase-ase.getObjects">
<Input>
<Column name="database" value="${catalog}"/>
<Column name="type" value="P"/>
</Input>
</Command>
</DataNode>
</GroupNode>

</DataNode>
</GroupNode>

<!-- ================================================================= -->
<!-- DBA Nodes -->
<!-- ================================================================= -->

<GroupNode type="DBA" label="DBA Views">
<GroupNode type="ServerInfo" label="Server Info" isLeaf="true"/>

<GroupNode type="Logins" label="Logins">
<DataNode type="Login" label="${sybase-ase.getLogins.Name}" isLeaf="true">
<Command idref="sybase-ase.getLogins"/>
</DataNode>
</GroupNode>

<GroupNode type="Devices" label="Database Devices">
<DataNode type="Device" label="${sybase-ase.getDevices.Name}" isLeaf="true">
<Command idref="sybase-ase.getDevices"/>
</DataNode>
</GroupNode>

<GroupNode type="RemoteServers" label="Remote Servers" isLeaf="true"/>

<GroupNode type="Processes" label="Processes" isLeaf="true"/>

<GroupNode type="ServerRoles" label="Roles">
<DataNode type="ServerRole" label="${sybase-ase.getServerRoles.NAME}" isLeaf="true">
<Command idref="sybase-ase.getServerRoles"/>
</DataNode>
</GroupNode>

<GroupNode type="Transactions" label="Transactions" isLeaf="true"/>

<GroupNode type="Locks" label="Locks" isLeaf="true"/>

</GroupNode>

</ObjectsTreeDef>

<!-- =================================================================== -->
<!-- Definition of the database objects views -->
<!-- =================================================================== -->

<!-- Include the generic-view -->
&generic-view;

<ObjectsViewDef id="sybase-ase" extends="generic">
<ObjectView type="Catalog">
<!-- Drop all views since these are available for type="Tables" -->
<DataView type="Tables" action="drop"/>
<DataView type="References" action="drop"/>
</ObjectView>

<ObjectView type="Tables">
<DataView type="Tables" label="Tables" viewer="grid">
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="tableType" value="TABLE"/>
</Input>
</Command>
<Action name="Script: SELECT ALL" template="SelectAllCommand">
<Map from="TABLE_SCHEM" to="schema"/>
<Map from="TABLE_NAME" to="table"/>
</Action>
<Action name="Script: DROP TABLE" template="DropTableCommand">
<Map from="TABLE_SCHEM" to="schema"/>
<Map from="TABLE_NAME" to="table"/>
</Action>
</DataView>
<DataView type="References" label="References" viewer="tables-refs">
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="schemaName" value="${getSchemas.TABLE_SCHEM}"/>
<Column name="tableName" value="%"/>
<Column name="tableType" value="TABLE"/>
</Input>
</Command>
</DataView>
</ObjectView>

<!-- Sub def of the Table type view -->
<ObjectView type="Table">
<!-- Add the Trigger view -->
<DataView type="Trigger" label="Triggers" viewer="form">
<Command idref="sybase-ase.getTableTriggers">
<Input>
<Column name="database" value="${getTables.TABLE_CAT}"/>
<Column name="owner" value="${getTables.TABLE_SCHEM}"/>
<Column name="name" value="${getTables.TABLE_NAME}"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="SystemTables">
<DataView type="SystemTables" label="SystemTables" viewer="grid">
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="tableType" value="SYSTEM TABLE"/>
</Input>
</Command>
<Action name="Script: SELECT ALL" template="SelectAllCommand">
<Map from="TABLE_SCHEM" to="schema"/>
<Map from="TABLE_NAME" to="table"/>
</Action>
</DataView>
<DataView type="References" label="References" viewer="tables-refs">
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="schemaName" value="${getSchemas.TABLE_SCHEM}"/>
<Column name="tableName" value="%"/>
<Column name="tableType" value="SYSTEM TABLE"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="SystemTable">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Columns" label="Columns" viewer="grid">
<Command idref="getColumns">
<Input>
<Column name="catalogName" value="${getTables.TABLE_CAT}"/>
<Column name="schemaName" value="${getTables.TABLE_SCHEM}"/>
<Column name="tableName" value="${getTables.TABLE_NAME}"/>
</Input>
</Command>
</DataView>
<DataView type="Data" label="Data" viewer="table-data">
<Message>
<![CDATA[

<html>
Note: This is a system table. Do not edit unless you are really sure what you're
doing!
</html>
]]>
</Message>
</DataView>
<DataView type="RowCount" label="Row Count" viewer="table-rowcount"/>
</ObjectView>

<ObjectView type="Views">
<DataView type="Views" label="Views" viewer="grid">
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="tableType" value="VIEW"/>
</Input>
</Command>
<Action name="Script: SELECT ALL" template="SelectAllCommand">
<Map from="TABLE_SCHEM" to="schema"/>
<Map from="TABLE_NAME" to="table"/>
</Action>
</DataView>
<DataView type="References" label="References" viewer="tables-refs">
<Command idref="getTables">
<Input>
<Column name="catalogName" value="${getCatalogs.TABLE_CAT}"/>
<Column name="schemaName" value="${getSchemas.TABLE_SCHEM}"/>
<Column name="tableName" value="%"/>
<Column name="tableType" value="VIEW"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="View">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Columns" label="Columns" viewer="grid">
<Command idref="getColumns">
<Input>
<Column name="catalogName" value="${getTables.TABLE_CAT}"/>
<Column name="schemaName" value="${getTables.TABLE_SCHEM}"/>
<Column name="tableName" value="${getTables.TABLE_NAME}"/>
</Input>
</Command>
</DataView>
<DataView type="Data" label="Data" viewer="table-data"/>
<DataView type="RowCount" label="Row Count" viewer="table-rowcount"/>
<DataView type="Index" label="Indexes" viewer="grid">
<Command idref="getIndexes"/>
</DataView>
<DataView type="Source" label="Source" viewer="text">
<Command idref="sybase-ase.getObjectSource">
<Input>
<Column name="database" value="${catalog}"/>
<Column name="owner" value="${getTables.TABLE_SCHEM}"/>
<Column name="name" value="${getTables.TABLE_NAME}"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="Users">
<DataView type="Users" label="Users" viewer="grid">
<Command idref="sybase-ase.getUsers"/>
</DataView>
</ObjectView>

<ObjectView type="Groups">
<DataView type="Groups" label="Groups" viewer="grid">
<Command idref="sybase-ase.getGroups"/>
</DataView>
</ObjectView>

<ObjectView type="Group">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Users" label="Users" viewer="grid">
<Command idref="sybase-ase.getGroupUsers"/>
</DataView>
</ObjectView>

<ObjectView type="Triggers">
<DataView type="Triggers" label="Triggers" viewer="grid">
<Command idref="sybase-ase.getTriggers">
<Input>
<Column name="database" value="${catalog}"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="Trigger">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Source" label="Source" viewer="text">
<Command idref="sybase-ase.getObjectSource">
<Input>
<Column name="database" value="${catalog}"/>
<Column name="owner" value="${sybase-ase.getTriggers.owner}"/>
<Column name="name" value="${sybase-ase.getTriggers.name}"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="Types">
<DataView type="Types" label="User Defined Data Types" viewer="grid">
<Command idref="sybase-ase.getUserTypes"/>
</DataView>
</ObjectView>

<ObjectView type="Procedures">
<DataView type="Procedures" label="Procedures" viewer="grid">
<Command idref="sybase-ase.getObjects">
<Input>
<Column name="database" value="${catalog}"/>
<Column name="type" value="P"/>
</Input>
</Command>
</DataView>
</ObjectView>

<ObjectView type="Procedure">
<DataView type="Columns" action="drop"/>
<DataView type="Interface" label="Interface" viewer="form">
<Command idref="getProcedureColumns">
<Input>
<Column name="catalogName" value="${catalog}"/>
<Column name="schemaName" value="${sybase-ase.getObjects.owner}"/>
<Column name="procedureName" value="${sybase-ase.getObjects.name}"/>
</Input>
</Command>
</DataView>
<DataView type="Source" label="Source" viewer="text">
<Command idref="sybase-ase.getObjectSource">
<Input>
<Column name="database" value="${catalog}"/>
<Column name="owner" value="${sybase-ase.getObjects.owner}"/>
<Column name="name" value="${sybase-ase.getObjects.name}"/>
</Input>
</Command>
</DataView>
</ObjectView>

<!-- ================================================================= -->
<!-- DBA Views -->
<!-- ================================================================= -->

<ObjectView type="ServerInfo">
<DataView type="Info" label="Server Info" viewer="grid">
<Command idref="sybase-ase.serverInfo"/>
</DataView>
<DataView type="Info" label="Character Set" viewer="grid">
<Command idref="sybase-ase.getCharSet"/>
</DataView>
</ObjectView>


<ObjectView type="Logins">
<DataView type="Logins" label="Logins" viewer="grid">
<Command idref="sybase-ase.getLogins"/>
</DataView>
</ObjectView>

<ObjectView type="Login">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Databases" label="Databases" viewer="grid">
<Command idref="sybase-ase.getLoginDatabases"/>
</DataView>
<DataView type="Roles" label="Roles" viewer="grid">
<Command idref="sybase-ase.getLoginRoles"/>
</DataView>
</ObjectView>

<ObjectView type="Devices">
<DataView type="Devices" label="Database Devices" viewer="grid">
<Command idref="sybase-ase.getDevices"/>
</DataView>
</ObjectView>

<ObjectView type="Device">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Databases" label="Databases" viewer="grid">
<Command idref="sybase-ase.getDeviceDatabases"/>
</DataView>
</ObjectView>

<ObjectView type="RemoteServers">
<DataView type="RemoteServers" label="Remote Servers" viewer="grid">
<Command idref="sybase-ase.getRemoteServers"/>
</DataView>
</ObjectView>

<ObjectView type="ServerRoles">
<DataView type="ServerRoles" label="Roles" viewer="grid">
<Command idref="sybase-ase.getServerRoles"/>
</DataView>
</ObjectView>

<ObjectView type="ServerRole">
<DataView type="Info" label="Info" viewer="node-form"/>
<DataView type="Logins" label="Logins" viewer="grid">
<Command idref="sybase-ase.getRoleLogins"/>
</DataView>
</ObjectView>

<ObjectView type="Processes">
<DataView type="Processes" label="Processes" viewer="grid">
<Command idref="sybase-ase.getProcesses"/>
</DataView>
</ObjectView>

<ObjectView type="Transactions">
<DataView type="Transactions" label="Transactions" viewer="grid">
<Command idref="sybase-ase.getTransactions"/>
</DataView>
</ObjectView>

<ObjectView type="Locks">
<DataView type="Locks" label="Locks" viewer="grid">
<Command idref="sybase-ase.getLocks"/>
</DataView>
</ObjectView>

</ObjectsViewDef>

</DatabaseProfile>



Copyright © 2006 Onseven Software AB. All rights reserved.