views:

117

answers:

5

My primary area is HW/Software interaction & Robotics, but we're running into situations where having a few database tables would be handy. I've got almost no knowledge on DBs.

What is a good primer on Database programming that would quickly get me up to speed on create/add entries/delete entries/query. Prefer either a basic Flat-file database program, or PostGreSQL in C or C++. In the case of a flat-file database, needs to be an OpenSource license, BSD style if it must be compiled-into the main executable.

+8  A: 

You might look at SQLite for your specific purpose. Very lightweight, embedable server-less RDBMS. Almost like a cross between an RDBMS server and flat file. Plenty of relational DB tutorials out there (I'd start with SQLZoo).

bdl
Thanks, SQLite looks like what I am looking for, and SQLZoo seems to be a great introduction.
Luciano
A: 

If you're looking for a quick SQL database, what about SQLite? http://www.sqlite.org/ - totally free, SQL-compatible but minus the database server if you don't need one.

Has a C/C++ API, Intro here: http://www.sqlite.org/cintro.html

Ninefingers
A: 

SQLite is easily embeddable. There are a few C++ wrappers for the API (pick the one you like). Of course, this is only if you need SQL.

If your needs are more simple, I always consider Berkeley DB. It's lean & mean, but you have a bit of lifting to do when making relational joins.

For even simpler cases, I use Boost's Serialization library to dump my instances. When I've used it, I've been able to dump my app's entire state and load it on initialization. It's also good for dumping out collections (maps, lists, vectors, etc.)

Pestilence
+1  A: 

If you're into the STL and Boost then this is probably the best database access library:

http://soci.sourceforge.net/

It supports PostgreSQL.

Manuel
A: 

sqlite3x, available as original version and derived (hacked, cleaned-up, and documented) version, is a min­i­mal­is­tic C++ wrap­per for SQLite 3.x, in­spired by the ADO.​NET in­ter­faces.

I find it really nice if you are using C++ and want to use SQLite.

dalle