db40
Object databases…I had no idea they were so useful and simple to use. Just imagine, db40 (Berkeley DB) is just one dll! Read it again. It’s just one simple dll; no setup or configuration or management or anything. Portable efficient storage of data. That’s how the whole of IT should be. Here are a few things I want to keep for myself and remember me how wonderful life can be.
Storage
Simple storage of an object in db40, ain’t it marvelously efficient; no insert statement or connections or queries:
1
2
3
4
|
[storeFirstPilot]
Pilot pilot1 = new Pilot("Michael Schumacher", 100);
db.Set(pilot1);
Console.WriteLine("Stored {0}", pilot1);
|
Retrieval
1
2
3
4
5
6
7
8
9
10
11
12
13
|
public static void ListResult(ObjectSet result)
{
Console.WriteLine(result.Count);
foreach (object item in result)
{
Console.WriteLine(item);
}
}
[retrieveAllPilotQBE]
Pilot proto = new Pilot(null, 0);
ObjectSet result = db.Get(proto);
ListResult(result);
|
Updating
1
2
3
4
5
6
7
|
[updatePilot]
ObjectSet result = db.Get(new Pilot("Michael Schumacher", 0));
Pilot found = (Pilot)result.Next();
found.AddPoints(11);
db.Set(found);
Console.WriteLine("Added 11 points for {0}", found);
RetrieveAllPilots(db);
|
Hi!
I would like make better my SQL capabilities.
I red so many SQL books and would like to
get more about SQL for my occupation as mysql database manager.
What can you recommend?
Thanks,
By werutzb October 8, 2008 - 3:38 amWerutz