There must be some way to have the set of tabular data not each be their own separate files.The .lck file is created by DBD::DBM, if you don't need locking, you can turn locking off and that file won't be created. The other two files are created by your underlying DBM implemnetation, some of those create only a single file per table and some create two files per table, that's how DBM works.
If I have 100 tables, I can't handle 300 files in one directory just for the database to work.What's wrong with 300 files? The whole point of a database is that you shouldn't need to worry about how it physically stores the data so the fact that there are multiple files is really irrelevant. You will be using SQL to CREATE and DROP tables, the fact that creating and dropping happens to create multiple files, doesn't really impact the basic SQL operations. You will never actually handle the files as files, only as SQL tables, the same way you would any SQL table. But, in any case, if that bothers you, use DBD::SQLite which stores all tables for a given database in a single file.
Second question is seems more of an SQL question but when you SELECT something from the table such as: SELECT phone FROM user WHERE user_name < 'Fred'; To store the results, you could use: my $var = SELECT phone FROM user WHERE user_name < 'Fred';Well, that's actually a DBI question. You can put the reuslts of a query in a variable with DBI's $dbh->selectrow_array, $dbh->selectall_arrayref, etc. or prepare and execute a statement handle and use a loop with $sth->fetch or $sth->fetchrow_harshref, etc.
While I agree with the other posters that for most production work (but by no means all), a full RDBMS like PostgreSQL or MySQL is better than DBD::DBM, but since you appear to be in the early learning stages, DBD::DBM should work fine for you - you can learn basic SQL and DBI with it just fine.
disclaimer I'm the author of DBD::DBM so I'm prejudiced. OTOH, the reason it is included in the DBI distribution is because it is sufficient for learning the basics of DBI access to databases.
In reply to Re: DBD::DBM file creation
by jZed
in thread DBD::DBM file creation
by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |