1. How to convert flat file database to dbm databases
I have the flat file database for people's beeper numbers and email
addresses:
Current I simply search the "key", and if it is a "user key",
then I simply get the "values": beeperid and email address,
and then send page or/and email according to options. And if it is
an "alias key", then I further expand the value to beeperid's.
This is done in Perl.
As the file grow, performance is an issue. So I would like to convert
to dbm and change the program accordingly. What is the best way to
do this? "dbm" files contain only a pair. So I have to create
three user dbm databases, and three alias dbm databases like:
user -> Beeperid
user -> Real Name
user -> Email
alias -> Beeperid
alias -> Real Name
alias -> Email
Then I query different databases to have everything resolved? If this
what I need to do, what is the tool that I can use. I find that
makedbm in Solaris deos not work with dbm_fetch as shown below:
#include <ndbm.h>
#include <stdio.h>
#include <fcntl.h>
#define NAME "a"
#define DB_NAME "db"
main()
{
DBM *db;
datum name = {NAME, sizeof (NAME)};
datum val;
db = dbm_open(DB_NAME, O_RDONLY, 0600);
val = dbm_fetch(db, name);
(void) printf("Name: %s, Value: %s\n", name.dptr, val.dptr);
dbm_close(db);
return (0);
[pizza:/export/home/root/C]gcc query_dbm.c
[pizza:/export/home/root/C]echo a b | makedbm - db
[pizza:/export/home/root/C]./a.out
Segmentation Fault(coredump)
--
Michael Wang
http://www.mindspring.com/~mwang
2. FTP uploaded file permissions?
3. converting host file to named database files
5. search in files / database files
7. converting database file to passwd file
8. Mac to PCL printing via Netatalk and gs.
10. Enhanced security Database Corruption
11. Freeware UNIX databases and security
12. Linux database security resources
13. Unix Database Security in a Banking World