Proposal: Database Engine for D

Abdulhaq via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 3 11:48:42 PST 2016


On Thursday, 31 December 2015 at 17:14:55 UTC, Piotrek wrote:
> The goal of this post is to measure the craziness of an idea to 
> embed a database engine into the D language ;)
>
> I think about a database engine which would meet my three main 
> requirements:
>   - integrated with D (ranges)
>   - ACID
>   - fast
>
> Since the days when I was working on financing data SW I become 
> allergic to SQL. I though that NoSQL databases would fill the 
> bill. Unfortunately they didn't. And I want to have an ability 
> to write a code like this without too much effort:
>
>   struct Person
>   {
>    string name;
>    string surname;
>    ubyte age;
>    Address address;
>   }
>
>  DataBase db = new DataBase("file.db");
>  auto coll = db.collection!Person("NSA.Registry");
>  auto visitationList = coll.filter!(p => p.name == "James");
>  writeln (visitationList);
>
> And other things like updating and deleting from db. I think 
> you get my point.
>
> So I started a PoC project based on SQLite design:
> https://github.com/PiotrekDlang/AirLock/blob/master/docs/database/design.md#architecture
>
> The PoC code: 
> https://github.com/PiotrekDlang/AirLock/tree/master/src/database
>
> Can you please share your thoughts and experience on the topic? 
> Has anyone tried similar things?
>
> Piotrek

My two pence, if you want it to be fast then it must have a good 
implementation of indices. Your filter functions should not 
actually start collecting real records, but instead should simply 
change the way that the cursor traverses the underlying data 
store. You will need good query 'compilation' like the big boys 
do, which work out which tables and indices to use and in which 
order, based on stats of the data / indices.

If you want ACID then SQL seems like a good approach to me, 
certainly I wouldn't want anything ORM-like for updating / 
inserting data.

There a number of good libraries out there already, SQLite 
obviously springs to mind.

It would be a fun project but perhaps a lot more work than you 
realised if you really want isolation levels, speed etc.


More information about the Digitalmars-d mailing list