AjBase (1) Implementing an In-Memory Database

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:


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

One thought on “AjBase (1) Implementing an In-Memory Database

  1. Pingback: New Month’s Resolutions: March 2012 « Angel “Java” Lopez on Blog

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s