Angel \”Java\” Lopez on Blog

February 29, 2012

AjBase (1) Implementing an In-Memory Database

Filed under: .NET, AjBase, C Sharp, Open Source Projects — ajlopez @ 8:29 pm

In mid 2009, I started to write an in-memory database, as a coding exercise in C#. These days, I resumed work on that project. Now the code resides in my GitHub repository:

https://github.com/ajlopez/AjBase

Nice history image at Github:

The current solution:

As usual, it was developed using Test-Driven Development. All tests in green:

The key implemented elements are:

Engine: It has a list of created databases (in memory, there is no persistence).

Database: It is the container for tables.

Table: A table has rows, and a RowDefinition.

RowDefinition: it manages the list of columns in a table.

Row: it keeps the values of the table columns, in an object array.

I have a doubt: to keep the schema (RowDefinition) per table, or go for a schema-less (free columns) per row. Now, I will keep the schema approach.

This year, I started to parse SQL statements. SQL is not my preferred languages (too many quirks, etc…), but the project can parse the simplest commands:

I want to add an ADO.NET provider, see the Data namespace:

I have a simple ADO.NET DbConnection, with some very basic (incomplete) ExecuteQuery, ExecuteNonQuery support.

Next steps: complete ADO.NET provider, more SQL parse support, concurrency and transaction support (big challenges! :-).

Next posts: examples for creating a database, creating a table, inserting data, selecting data, by code and by SQL statements. Meanwhile, you can explore the tests code, to see how to code those examples.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

1 Comment »

  1. [...] about my work on AjRools complete – New post about my work on AjLisp in Ruby pending – Post about my work on AjBase complete – Play with Clojure REPL complete – Post about Understanding Node.js (first [...]

    Pingback by New Month’s Resolutions: March 2012 « Angel “Java” Lopez on Blog — March 7, 2012 @ 7:09 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Shocking Blue Green Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 66 other followers

%d bloggers like this: