Firebird Tools
When I started developing Firebird databases for use with Delphi 5,
there were a number of problems ... and basically, I found the available tool sets
to be unusable.
As a result, I wrote a number of tools to simplify the tasks I had to perform.
This page describes
some of those tools.
Note - this software is still under development, it is provided as is.
I use it every day and find it useful.
Notes: |
| These tools were developed using Delphi 5. I am not making the source available because
there are a lot of libraries and I don't want everyone to see what a mess they are.
These tools use only the default UserID and Password.
|
Firebird_Aliases.ini
All 4 exe files read the Firebird_Aliases.ini file located in the same
directory as the exe file.
As a result, it is necessary to modify that file before any of the programs will work.
When developing software, I found that I was using the same group of databases
for all the related programs.
The 4 tools provided
in the zip file
use the same ini file.
fdb files must be located on the same machine
as the Firebird server - if the database is on another machine,
place the computer name in front of the path *as seen on the other machine*
[Databases]
Samples = C:\abc_DB\Firebird Databases test\Samples.fdb
Barcode = C:\abc_DB\Firebird Databases test\BarcodeGenerator.fdb
SOP = C:\abc_DB\Firebird Databases test\Procedures.fdb
Users = C:\abc_DB\Firebird Databases test\General.fdb
abc = computerName:C:\abc_DB\Firebird Databases test\abc.fdb
I find this method very user friendly
- Once the ini file is developed, all the software uses the same databases
- Development, Test, and Production databases are identified by using separate
ini files located in separate directories. This way, the only difference between
Development, Test, and Production executables is an external control file.
- I don't have to use file open, remember a file name, and then navigate
to it every time I just want to view some data.
Firebird_Viewer.exe
This program allows you to see and edit every table in the databases referenced
in Firebird_Aliases.ini.
Instructions
- Use the tree view to select any table in any configured database
- Check Allow Edits to modify the data - click the check mark (in the navigation bar)
to save your changes
- Click Save Column Widths to set and remember column widths
for the currently displayed table ONLY
- Use Column Widths controls whether the saved values are used
- Click on any column heading to sort that column in either
Ascending (blue) or Descending (green) order (descending order is not
available when Allow Edits is checked)
- The bottom panel displays the contents of the selected field -
useful for viewing (and editing) the contents of a blob (memo) field
- In the table tree, right click to copy either the displayed value
or the full path to the database to the clipboard
- In the table grid, clicking any field name places that value on the clipboard
- Refresh gets new data (if any)
QueryTester.exe
This program allows you to run queries against the databases referenced
in Firebird_Aliases.ini.
Remember - any table or field name that should be mixed case MUST be enclosed in double quotes.
Firebird_Table_Viewer.exe
This is a web based (CGI) version of Firebird_Viewer.exe -
via a web browser,
it allows you to examine (but not edit) all the tables
in the databases referenced in Firebird_Aliases.ini.
Instructions
Use the 2 comboboxes to select one of the databases defined in Firebird_Aliases.ini and an appropriate table
Click on any column heading to sort that column in either
Ascending (blue) or Descending (green) order
There is no way to view the contents of a blob (memo) fields
Pump_Tab_Delimited_Data.exe
This program is used to populate new copies of the databases.
It automatically reads the Firebird_Aliases.ini file in the same directory
and processes a data definition file.
To run this as a stand alone program, use
Pump_Tab_Delimited_Data.exe /show
Most of the time, I run it via a bat file (see below).
Users_LU.dat
This example is from Users_LU.dat
- Database / alias refers to one on the aliases in Firebird_Aliases.ini
- The other sections (the program supports any number) specify table names
- DataType = explicit is required (other formats are beyond the scope of this document)
- Mixed case field names must be enclosed in double quotes
- Field names must be separated by commas
- The data must be formatted in a manner compatible with an insert into query
- Separate values with comas
- Any number of spaces and tabs can separate values
- Strings must be placed in single quotes
- Only one line per record and one record per line
This is the file
[Database]
alias = Users
[Contact_Types_LU]
DataType = explicit
Fields = "Contact_Type_ID", "Contact_Type"
'Phone', 'Telephone'
'Cell', 'Cell Phone'
// Comments can occur any where (as can blank lines)
; This is another comment
: And yet another comment
'email', 'email'
'Pager', 'Pager'
'Web', 'Web Page'
The above dat file will create 5 sql statements similar to the following
insert into "Contact_Types_LU" set ("Contact_Type_ID", "Contact_Type") values ('Phone', 'Telephone')
These files allow any number of comments and blank lines :)
Example bat File
To fully automate database creation and initialization,
I use *.bat files that
- Create an empty database (via Users_Create.sql in the following example)
- Populate various tables (via Users_LU.dat and Users.dat in the following example)
The echo's make debug much easier
echo Start of bat file
"C:\Program Files\Firebird\Firebird_1_5\bin\isql.exe" -i "Users_Create.sql" >Build_Log.txt
echo All tables are now created, Starting data pump
echo All tables are now created, Starting data pump >>Build_Log.txt
: All the tables now exist, but they have no data
echo Processing Users_LU.dat
"C:\abc_DB\Firebird Databases test\support_Files\Pump_Tab_Delimited_Data.exe" /in=Users_LU.dat
echo Processing Users.dat
"C:\abc_DB\Firebird Databases test\support_Files\Pump_Tab_Delimited_Data.exe" /in=Users.dat
echo end of build script
echo end of build script >>Build_Log.txt
pause
I run this by simply double clicking the bat file.
The pause keeps the dos window from closing so that I can see the errors ... if any.
Author: Robert Clemenzi -
clemenzi@cpcug.org