Simple database

From Rosetta Code
Revision as of 09:35, 1 November 2011 by rosettacode>EMBee (simple commandline tools)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Simple database is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Write a simple tool to track a small set of data. The tool should have a commandline interface to enter at least two different values. The entered data should be stored in a structured format and saved to disk.

It does not matter what kind of data is being tracked. It could be your CD collection, your friends birthdays, or diary.

You should track the following details:

  • A description of the item. (eg title, name)
  • A category or tag (genre, topic, relationship (friend, family))
  • A date (either the date when the entry was made or some other date that is meaningful (like the birthday))

The command should have the following commandline options to run:

  • Add a new entry
  • Print the latest entry
  • Print the latest entry for each category
  • Print all entries sorted by a date

The category may be realized as a tag or as structure (making all entries in that category subitems)

The fileformat on disk should be human readable, but it need not be standardized. A natively available format that doesn't need an external library is preferred. Avoid developing your own format however if you can use an already existing one. If there is no existing format available pick one of: JSON, S-Expressions, YAML, or others.