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.