January 23, 2005-- Released version 1.1, which supports all five DBM formats, lets you display choices in a select menu, treats non-English text better, and fixes a couple bugs.
If you use DBM files, this program makes them easy to edit. Each value stored in a DBM file is treated as several "fields", delimited by a user-defined string-- in effect, supporting multiple columns within the one-column DBM format. This program displays a DBM database as a table, and provides auto-sized forms to add or edit records. You can edit your existing DBM files or create new ones. Multi-user access is safe. Requires Perl 5.
A demo is worth a thousand words. Username "dbmedit", password "demo". Do me a favor and delete garbage records (but leave entertaining ones). Here's the initial input screen, which in this demo will only work if the file name is demo. Don't be alarmed if you get warnings; it just means other people are trying it at the same time.
Download DBMEdit 1.1 (gzipp'ed)
[A DBM file is a simple Unix database. DBM files store key-value pairs in a way that allows fast retrieval, so they can be faster than using simple text data files. Perl supports DBM files through the NDBM_File module; other languages support them in other ways. DBM files are useful in Web development when you need a simple database and you can't (or don't want to) use a full database server. DBM files do not support any queries beyond a simple key lookup.]
It's pretty self-explanatory. Access the script with no parameters to see the initial entry screen, where you define a new or existing DBM database to edit.
A database is defined by the DBM file name, the column descriptions, and the delimiter between fields. After you define your database for the first time, copy the full URL into a bookmark or HTML link for easy access in the future. I keep an "admin" page with such links to all the DBM files I edit.
If you're using Perl 5.6.0 or before, some bugs in the DBM modules prevent multiple DBM types from being supported, so only NDBM_File is supported by default. If you want to use another DBM file type, set $DEFAULT_DBM_TYPE in the configuration section. If you're using Perl 5.6.1, newly created DBM files will be in GDBM format; otherwise, they'll be in NDBM format.
The script runs fast enough, but a DBM file with many records will mean a large table is displayed, which may take your browser a while to render. It's only annoying with big DBM files, but then, DBM's main advantage comes when you have many records... oh well. Maybe it should display large files differently, but columns won't line up without tables.
Many features could easily be added; see the source code for examples. I can add them if there is demand, or others can easily modify the code if they want to.
Last Modified: January 23, 2005 | http://www.jmarshall.com/tools/dbmedit/ |