Hi Jesse,
On 2013-03-12 22:19, Jesse Molina wrote:
I have a huge complicated script that now needs a database.
My needs are very modest. A comma delineated file would probably be
fine, but this script is going to be both reading and writing to
it's tables. It's mostly when I have to start writing my data out
that stuff gets ugly.
It sounds like you're already aware, but just in case: you don't want to use
bash to do this as you'll get huge performance drop off when you're not
appending.
sqlite is perfect for this, but I wanted to ask if there are any
other tiny database/data structure apps which are often used with
bash, or examples of implementing complicated data structures with
bash.
Most people don't use databases with bash, but as long as your database
application accepts input sensibly from STDIN (ie. it has reliable escaping
methods in its command line client, and if you have untrusted input, there are
more things that you need to verify as well), then you should be fine.
Ideally you'd have a client that respects argument quoting properly. I know of a
few who take commands as a single argument and then eval it. That's almost
definitely a bad idea in a script. You want something that properly escapes
based upon which argument is being read, and internally escapes appropriately.
I don't know off the top of my head which databases do/do not have a client like
that. Hopefully there are some out there (or you can, of course, write a wrapper
for your database in some other language that takes command line arguments, and
escapes them appropriately based upon what each argument represents).
Best of luck with your script.
Chris