Hello,
If you've been reading my other nodes, you probably know that I've been learning how to use DBM and I'm pretty new at this. I currently have a database with the following structure:
CATALOG NUMBER (this is the hash key) | PIPE-DELIMINATED DATA | SORT NUMBER
The database is accessed in several ways:
- Displaying large groups of data. A beginning key and an ending key are specified and the program gets their sort numbers and prints everything in between, sorting the results by the sort number.
- Random access. A person specifies a group of keys and their records are returned, sorted by the sort number.
- Single-key access. A person enters a key and the database spits out the result.
The catalog number structure makes it seemingly impossible to sort by it (please correct me if I'm wrong!). It contains numbers like 219 or 614 but also ones like 751a or 930c. In addition, towards the end, there are numbers like C18 or E9. The subscripted numbers (ones like 751a) always come after their numerical counterparts (like 751). Example: 751a would come after 751. The catalog numbers with a prefix in front of them (like C18) always come at the end of the database. I can't do away with the catalog numbering system but I can't seem to figure out how to sort by it either.
My problem is this: I need to be able to add and delete keys from the database. When I add a key, how do I know what sort number I should use?
I would appreciate any suggestions of ways to fix this problem, or ways to simplify/optimize the way I currently do this. Thanks!
Stamp_Guy
Why is "abbreviated" such a long word?
Note: If further information would help, please /MSG me in the CB.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.