DBUtil - Database utilities for Borland Delphi


Introduction
For some reason, neither the Database Desktop that ships with Delphi, nor the Paradox or dBase programs themselves include a facility for printing table definitions. There are a couple of shareware table structure printers out there, but I decided to write one to give me more experience in formatting printed output, as well as to give me the chance to hack through capabilities of the Borland Database Engine that were not encapsulated in Delphi.

Since I've downloaded lots of cool, free stuff off of CompuServe and the Internet, I decided to make this program available for free, with no restrictions (except for obvious ones, such as I still own the source code). So I hope this program proves helpful to you, and if you put together a cool component or utility, post it for free (or at least Email me a copy <g>).

Installing DBUtil
DBUtil requires the Borland Database Engine (BDE) DLLs that ship with Delphi. In order to minimize the download file size, I omitted these files. Anyone who owns Delphi or Paradox 5.0 will have the necessary BDE files. If you do not have the necessary DLLs, drop me an Email and I'll be glad to send them to you if you cover the mailing costs.

To install DBUtil, unzip the DBUTIL.ZIP file and run the program. If you decide you like DBUtil, you may wish to add it to your Delphi Tools menu.

Running DBUtil
DBUtil is a standard multiple document interface (MDI) application. You can browse as many databases as you like, subject to the normal memory and resource limitations. To browse a database, select the File | Open Database menu item or click on the Open Database toolbar button (it looks like a file folder). You will then see a tabbed dialog box, which will allow you to select a database either by directory or by BDE alias. If you select an alias, the Parameters window will list all of the relevant database parameters (such as directory, ODBC information, etc.).

Select a database and click OK (or double-click on the database). You'll get a tabbed Browser window, with a listing of all of the database's tables in the left column. Select one of the tables to view the database schema, indexes, and referential integrity constraints. Each of these items are displayed in their own tab page. Click on the tabs or press the accelerator key to move from one page to another.

The Table Details page lists the following items:
Table name
# of fields
# of records

The Fields page lists the following items:
Field Name
Data type
Size (where appropriate)
Whether the field is required
Whether the field is part of the primary key
Minimum value
Maximum value
Default value
Picture

The Indexes page lists the following items:
Index name
Fields
Expression (where appropriate)
Options (such as unique, case sensitive, etc.)

The Referential Integrity page lists the following items:
Ref. Int. name
Type of referential integrity
The name of the other table
Modification type (restrict or cascade)
Deletion type (restrict or cascade)
Fields in the active table
Fields in the corresponding referential integrity table

Note that the referential integrity information is only available for Paradox tables. Similarly, other information is not available for every type of table (for instance, there are no primary keys in dBase tables).

Printing Table Structures
Click on the Print toolbar button (it looks, not surprisingly, like a printer) or select File | Print from the menu to print the currently-selected table. The printout contains all of the information included in the browser.  Use the File | Print Setup menu item, or the corresponding toolbar button, to select a different printer or paper tray.

In order to fit all of the information in a fairly compact format, I've assumed that you are not using excessively long field or index names. If this is a problem, I could probably fix it in a later version.

The browser works with dBase and Paradox tables, as well as with any ODBC databases that you have properly configured. It works with MS Access tables, although finding and configuring the ODBC drivers is sometimes a hassle.

Viewing and Editing Tables
To view the records in the currently-selected table, select the Browse | View/Edit Table menu item, or click on the View Table toolbar button (it looks like a grid). You'll get a typical database grid, initially in a read-only mode. To edit a record, click the Edit On button. To return to read-only mode, click the Edit Off button. Delete a record by pressing <Ctrl><Delete>; add a record by pressing <Insert> or by moving to the bottom of the grid and pressing the down arrow.

You may also activate a different index by selecting an index from the combo box at the top of the grid form.

You can edit, insert and delete records in dBase, Paradox or ODBC tables.

Setting Options
There are a couple of options that you can set by choosing the File | Options menu item. First, you can select a font and font size for the report. You should choose a font size somewhere between 8 and 12 points, and a readable font (i.e., Wingdings is a poor choice <g>). You can also select portait or landscape printing. Landscape is a good choice if you have long field names, since a couple of the report columns stretch to fill the additional space.

All of the options that you select (plus whether you selected a database using a directory name or an alias) are stored in the dbutil.ini file which is placed in your \WINDOWS directory the first time you run the program.

Support, Updates, etc.
Not surprisingly, there is no toll-free technical support offered for this product. In fact, there is no paid technical support, either. On the other hand, if you come across a bug, or if something seems goofy, I'd like to know about it. You can reach me by Email either through the Internet or CompuServe:

	Robert Fabiszak
	Internet: rfabs@interramp.com
	CompuServe: 70304,2047

I read my Email most days, but if it takes me a day or two to get back to you, please be patient.

Standard Disclaimer
This program is copyright  1995 by Robert Fabiszak. All rights reserved. You are free to use it and distribute it to others, but you may not charge a fee for distribution.

DBUtil works on all of the machines I tested it on (both of them <g>). It should work on yours, too, but  I make no warranties that it will. I'm not any liable for any damages whatsoever arising from the use of this software, including (but not limited to) loss of data, business interruption, loss of profits, why the Buffalo Bills can't win the Super Bowl, or why it rains so much in Seattle. I own the source code (except, of course, certain parts licensed from Nevrona Designs or Woll2Woll Software). Thank you, drive through.

Version History
Version 1.0 released October, 1995.
Version 1.01 also released October, 1995: added landscape printing, options to set fonts and font sizes, bug fix wherein string default, min, and max values were ignored.
