The SZBD project is a simple SQL-like database engine implemented in C#. It includes a storage layer, a query engine, and a client application to interact with the database. The project supports basic SQL operations such as SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, and DROP TABLE.
- ClientApp: Contains the client application to interact with the database.
- QueryEngine: Implements the SQL-like query engine.
- StorageLayer: Manages data storage and indexing using B-Trees.
- SZBD.Tests: Contains unit tests for the project.
Below is a diagram illustrating the data flow and interactions between the different layers of the SZBD project:
graph TD;
ClientApp -->|Sends SQL Commands| QueryEngine;
QueryEngine -->|Parses and Executes| StorageLayer;
StorageLayer -->|Stores and Retrieves Data| QueryEngine;
QueryEngine -->|Returns Results| ClientApp;
- Download the ClientAppv1.0.0.rar file from releases.
- Extract the contents of the .rar file using software like WinRAR or 7-Zip.
- Run ClientApp.exe to start the application.
- .NET 8.0 SDK
- Visual Studio or any C# compatible IDE
- Clone the repository:
git clone <repository-url> cd SZBD
- Build the solution:
dotnet build
- Navigate to the
ClientAppdirectory:cd ClientApp - Run the application:
dotnet run
- Navigate to the
SZBD.Testsdirectory:cd SZBD.Tests - Run the tests:
dotnet test
On the first use, the application will ask for a directory that will be used as a storage for JSON files, you need to specify a folder like: C:\databasefolder Once the storage directory is specified and client application is running, you can interact with the database using SQL-like commands. Here are some examples:
-
Create a table:
CREATETABLE Users (Id INT PRIMARY KEY, Name STRING, Age INT);
-
Insert a row:
INSERTINTO Users (Id, Name, Age) VALUES (1, 'John Doe', 30);
-
Select all rows:
SELECT * FROM Users;
-
Update a row:
UPDATE Users SET Age = 31 WHERE Id = 1;
-
Delete a row:
DELETE FROM Users WHERE Id = 1;
-
Drop a table:
DROPTABLE Users;