# Database Browser

This tool provides you a simple browser for exploring database schema objects. Initially it can be said that the browser also provides a browser like functionality for the template help which is covered separately. This browser will provide you with more information and you will also in future versions of TOra be able to interact with schema objects (Dropping or create tables etc.), this is not possible in the template help version. The template help on the other hand is tree based and some people consider it easier and faster to work with.

## Using the browser

The database browser has a very simple interface with a toolbar which contain the following functions. All of these are also available in the Browser menu item except for the schema selection and change object.

Refresh | Refresh the displayed data from the database. Also available on the F5 key.
Define filter | Displays the define filter dialog. This is used to specify which objects to show in the browser. The default filter is to show everything. Also available on the CTRL+SHIFT+G key.
Clear filter | Remove the current filter and revert to the default of showing everything. Also available on the CTRL+SHIFT+H key.
Schema | The last item on the toolbar is a combo box where you can select the schema to display objects for. It defaults the schema you are currently logged in as. Only schemas that are visible to the current user is selectable in the lost (Really, TOra does not contain the secret DBA password that will always let you access everything regardless of your privileges).
Change connection | Change the connection this tool window should operate on.

The rest of the interface consists of two tabbed windows, one within the other. The first one you can use to select the object type you want to inspect. When you have selected a type you can see the visible objects of the specified type available in the selected schema. The second tab indicate what kind of information you want to explore about the selected object and depends on the object type (For more information about available information see this). When you select an object name in the left list you can inspect information about it to the right.

You can move the keyboard focus to the schema selection using ALT+S and to the current object list using ALT+N.

## Available information

This is the available information for the different object types.

Object type | Name | Description
Tables |  |
| Columns | A description of the columns in the table. For more information about this information also see object description.
| Indexes | A list with the indexes that have been created for this table.
| Constraints | Lists the constraints for this table.
| References | Displays the foreign key constraints that references this table and the other objects that have dependencies on this table.
| Grants | The grants that have been made on this table.
| Triggers | Lists the triggers that exist for this table.
| Data | Displays the data in the table. This is the only part of the database browser that let you modify any data. For more information about how to use the content editor see this.
| Information | Contains information about the table available in the SGA including analyzed statistics etc.
| Script | This tab displays an SQL script to recreate the database object.
Views |  |
| Columns | A description of the columns in the view. For more information about this information also see object description.
| SQL | The SQL that defines the view.
| Data | Displays the data in the view. This is the only part of the database browser that let you modify any data. For more information about how to use the content editor see this. You can not modify some views depending on how they are defined. See the Oracle reference for more information about editing views.
| Grants | The grants that have been made on this view.
| Dependencies | The objects that depend on this view.
| Script | This tab displays an SQL script to recreate the database object.
Indexes |  |
| Columns | The columns that the index operate on.
| Info | Information in the SGA about an index. For instance analyzed statistics available for this index.
| Script | This tab displays an SQL script to recreate the database object.
Sequences |  |
| Info | Information about the sequence.
| Grants | The grants that have been made on this object.
| Script | This tab displays an SQL script to recreate the database object.
Synonyms |  |
| Info | Information about the synonyms
| Grants | The grants that have been made on this object.
| Script | This tab displays an SQL script to recreate the database object.
PL/SQL |  |
| Declaration | The declaration of a package or type.
| Body | The implementation of a package, body, procedure or function.
| Grants | The grants that have been made on this object.
| Dependencies | Dependencies this object has.
| Script | This tab displays an SQL script to recreate the database object.
Triggers |  |
| Info | Information about the trigger.
| Code | The code that implement the trigger.
| Columns | The columns this trigger operates on.
| Grants | The grants that have been made on this object.
| Dependencies | Dependencies of this object.
| Script | This tab displays an SQL script to recreate the database object.

## Content editor

The content let you edit the contents of a table or view. There are a few things to note about this.

First of all the content editor is designed to behave nicely to the database which means that it will only save the data when it thinks you are finished editing a row. This happens when you the current row change or you commit the database. When there is unsaved data you can see it in the status bar that there exists unsaved data. Also observe that the content editor will respect the auto commit setting in the database settings.

The content editor has it's own toolbar with the following buttons.

Define filter | Displays the define filter dialog. This is used to specify which objects to show in the browser. The default filter is to show everything.
Clear filter | Remove the current filter and revert to the default of showing everything.
Add new record | Add a new record to the current table.
Save changes | Save the changes made to the current row to the database. Observe that this will not commit the changes.
Discard changes | Discard the changes made to the current row to the database. Observe that this will not rollback the database connection.
Delete current record | Delete the current record from the database.
Go to first row | Go to the first record in the editor.
Go to previous row | Go to the previous record in the editor.
Go to next row | Go to the next record in the editor.
Go to last row | Go to the last record in the editor. Observe that this will read in all available records in the table into memory.

The content editor can define a fileter to specify which part of a table to edit. This dialog looks like this.

In the selection criteria part you can add whatever you want to go after a where in a select statement. In the sort order you can list the columns you want to sort on. The sort order only affect the order the records are read from the database, after they are read you can still sort on any column by clicking it. To the right is a list of available columns in the table.

Finally at the bottom is a checkbox called use for all tables. If this box is checked the index is used for all tables, if not checked you can define specific filters for each tables and the content editor will remember the different filters as you jump between tables. The reason for this is that it's quite common that not all tables have all the columns you want to filter on for a table, in this case you will get an error trying to access the table with a faulty filter setting.

## Defining a filter

Filtering is based on the object name and can be specified in a variety of ways. This is the dialog used to specify the filter.

The most important part of this dialog is the editor which let you specify the string to apply the criteria to. This is not available for No filter setting. The different available types and options are.

No filter | No filter specified, display all objects.
Start with | Only include objects which name starts with the specified string.
End with | Only include objects which name ends with the specified string.
Contains | Only include objects which name contain the specified string.
RegExp | Only include objects which name matches the regular expression specified in the editor. The dialect of RegExp:s is the ones in the version of Qt that TOra is compiled against. For more information on regular expressions check out http://doc.trolltech.com/qregexp.html, if you are using Qt 3.0 or later you have a more advanced form of regular expressions.
Ignore case | Ignore the case when matches. Since object names are pretty much always uppercase it is probably safest to leave this on.
Invert selection | If set, include all the objects that does not meet the specified criteria instead of the ones which does.

Some objects you can also search on what tablespace they are located on. This can be specified by the lower part of the dialog.

Include all | Include all regardless of tablespace.
Include | Include the objects located on the selected tablespaces in the list below.
Exclude | Include the objects not located on the selected tablespaces in the list below.