D
drhowarddrfine
I don't want to use a db manager, like mysql, for such a small
database but I'm finding this trickier than I thought and hope someone
can provide some guidance.
I have a restaurant menu with prices and other info in a small file.
It's set up in a YAML-ish style, if you're familiar with that format.
I'm just looking for some ideas on the best way to retrieve data based
on a "keyword". What complicates things for me is that some of these
keywords might be inside a nested block, such as "prices:".
-navigation
link: link1
link: link2
-menu
chicken:
-roasted
-fried
steak:
-strip
prices:
small: 15.00
medium: 17.00
large: 19.00
-sirloin
prices:
small: 15.00
fish:
-location
In the above example, indentation matters. I am not bound by this
format so better ideas are welcome, but searching for menu->steak-
What complicates things is when I want to do something like
"next_record()". It must tell me there are no more prices in "strip"
and not mistakenly search into the "prices" records of "sirloin".
Is my whole concern my answer, too? That I am trying to write a small
db manager and it's not a simple solution? Or is there simply a
better idea I'm missing?
Originally I did this in XML but felt parsing the tags wasn't any
easier and my format, above, is more readable. I can't just store a
struct in the file because I want it to be editable with any text
editor.
Thanks,
Doc
database but I'm finding this trickier than I thought and hope someone
can provide some guidance.
I have a restaurant menu with prices and other info in a small file.
It's set up in a YAML-ish style, if you're familiar with that format.
I'm just looking for some ideas on the best way to retrieve data based
on a "keyword". What complicates things for me is that some of these
keywords might be inside a nested block, such as "prices:".
-navigation
link: link1
link: link2
-menu
chicken:
-roasted
-fried
steak:
-strip
prices:
small: 15.00
medium: 17.00
large: 19.00
-sirloin
prices:
small: 15.00
fish:
-location
In the above example, indentation matters. I am not bound by this
format so better ideas are welcome, but searching for menu->steak-
strip->prices->large returning "19.00" seems logical to me.
What complicates things is when I want to do something like
"next_record()". It must tell me there are no more prices in "strip"
and not mistakenly search into the "prices" records of "sirloin".
Is my whole concern my answer, too? That I am trying to write a small
db manager and it's not a simple solution? Or is there simply a
better idea I'm missing?
Originally I did this in XML but felt parsing the tags wasn't any
easier and my format, above, is more readable. I can't just store a
struct in the file because I want it to be editable with any text
editor.
Thanks,
Doc