Skip to content

Lfpast/In-Memory-Database-System

Repository files navigation

In-Memory Database System

This project implements a simple in-memory database system in C++. It supports creating tables with primitive and list columns, adding entries, indexing, and filtering.

Features

  • Table Structure: Supports dynamic addition of columns (Primitive and List types).
  • Indexing: Uses Binary Search Trees (BST) and Hash Tables for efficient indexing and retrieval.
  • Filtering: Supports filtering entries based on field values.
  • Data Structures: Custom implementation of BST and HashTable.

File Structure

  • table.h/tpp: Main Table class and Filter struct.
  • entry.h: Entry class representing a row.
  • basefield.h/tpp: Field definitions (PrimitiveField, ListField).
  • bst.h/tpp: Binary Search Tree implementation.
  • hashtable.h/tpp: Hash Table implementation.
  • hash.h: Hash function.
  • main.cpp: Test cases.

Compilation and Usage

Using Makefile

To compile the project, use the provided Makefile:

make

This will generate an executable named system (on Windows system.exe).

Manual Compilation

If you prefer to compile manually without make, you can use the following g++ command:

g++ -std=c++11 -g main.cpp -o system

Running the Program

To run the executable:

./system

You can input a test case ID (1-18) to run specific tests.

Example

Table table;
table.addListColumn<string>("tags", {});
table.addPrimitiveColumn<string>("time", "No time");
table.addEntry(Entry().addItemToListField<string>("tags", "UwU").setPrimitiveField<string>("time", "2023-10-01"));
cout << table << endl;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors