You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
InventixDB is a database management system built from scratch in C as a university semester project. It implements core database internals including a custom query language, B+ Tree storage, MVCC transactions, a cost-based query optimizer, and a distributed cluster layer with Raft consensus.
The system supports both relational (SQL-style) and document (NoSQL) data models, with a bilingual query interface accepting standard SQL and Hinglish syntax.
Key Highlights
Hybrid storage engine: B+ Tree indexing, LSM-Tree write path, columnar store for analytics
MVCC transactions with four isolation levels and deadlock detection
Cost-based query optimizer with plan caching and statistics
Length-prefixed binary protocol with compression and keepalive
Test Framework
Custom test runner with assertions, timing, and colored output
Configuration System
INI-style config file with section-based settings
Data Types
Type
Description
Example
INT
64-bit signed integer
42, -100
FLOAT
Double-precision floating point
3.14159
TEXT / STRING
Variable-length string
"Hello World"
BOOL
Boolean value
1 (true), 0 (false)
AUTO
Auto-increment integer
AUTO
Installation
Prerequisites
GCC 7.0+ or MinGW-w64 (Windows)
GNU Make
pthread library
Windows: Winsock2, advapi32, mswsock (included in Windows SDK)
Build from Source
# Clone the repository
git clone https://github.com/yourusername/inventixdb.git
cd inventixdb
# Build all components
make
# Build individual components
make inventixdb # CLI tool
make inventix-server # Database server
make inventix-client # Network client
make test_btree # B+ Tree tests
Build Output
Executable
Description
inventixdb
Standalone CLI database
inventix-server
Network database server
inventix-client
TCP client for connecting to the server
test_btree
B+ Tree unit tests
test_runner
Full test suite runner
Usage
Standalone Mode
# Start the interactive CLI
./inventixdb
# Execute an SQL file
./inventixdb < script.sql
Client-Server Mode
# Start the server (default port: 9876)
./inventix-server --port 9876
# Connect with the client
./inventix-client -h 127.0.0.1 -p 9876
InventixDB supports a bilingual query syntax allowing queries in both standard SQL and Hinglish (Roman-Urdu).
Keyword Mapping
SQL Keyword
Hinglish
Description
CREATE TABLE
TABLE BANAO
Create a new table
INSERT
INSERT KARO
Insert data
SELECT
SELECT
Query data
WHERE
JAHAN
Filter condition
DELETE
NIKALO
Delete records
UPDATE
UPDATE
Update records
DROP
GIRAO
Drop table
ALTER
BADLO_TABLE
Alter table
BEGIN
SHURU
Start transaction
COMMIT
PUKKA
Commit transaction
ROLLBACK
WAPAS
Rollback transaction
SAVEPOINT
NISHAAN
Create savepoint
PREPARE
TAYYAR
Prepare statement
EXECUTE
CHALAO
Execute statement
JOIN
MILAO
Join tables
LEFT
BAAYA
Left join
RIGHT
DAAYA
Right join
FULL
POORA
Full join
NATURAL
KUDRATI
Natural join
EXPLAIN
SAMJHAO
Explain query plan
ORDER
KRAM
Order results
ASC
CHADHTE
Ascending
DESC
UTARTE
Descending
LIMIT
SEEMA
Limit results
AND
AUR
Logical AND
OR
YA
Logical OR
COUNT
GINO
Count aggregate
SUM
JODO
Sum aggregate
AVG
AUSAAT
Average aggregate
MIN
SABSE_CHOTA
Minimum value
MAX
SABSE_BADA
Maximum value
GROUP BY
SAMOOH DWARA
Group results
HAVING
JISME
Filter groups
DISTINCT
ALAG
Unique values
LIKE
JAISA
Pattern match
IN
ANDAR
Set membership
BETWEEN
BEECH
Range check
EXISTS
MAUJOOD
Existence check
CASE
MAAMLA
Conditional
WHEN
JAB
Condition branch
THEN
PHIR
Result branch
ELSE
WARNA
Default branch
END
KHATAM
End block
BACKUP
SURAKSHA
Backup database
RESTORE
WAPAS_LAO
Restore database
EXPORT
BHEJO
Export table
IMPORT
LAAO
Import table
COLLECTION
SANGRAH
NoSQL collection
DOCUMENT
DASTAVEZ
NoSQL document
FIND
KHOJO
Find documents
UPSERT
DAL_YA_BADLO
Insert or update
AGGREGATE
IKATHA
Aggregation pipeline
HELP
MADAD
Show help
QUIT
NIKLO
Exit
STATUS
HALAT
Show status
Query Examples
Table Operations
-- Create table (SQL)CREATETABLEusers (
id INTPRIMARY KEY,
name TEXT,
email TEXT,
is_active BOOL
);
-- Create table (Hinglish)
TABLE BANAO users (
id INTPRIMARY KEY,
name TEXT,
email TEXT,
is_active BOOL
);
-- Create indexCREATEINDEXON users (email);
-- Alter tableALTERTABLE users ADD COLUMN age INT;
Data Manipulation
-- Insert data
INSERT KARO users VALUES (1, "Ali Khan", "ali@example.com", 1);
INSERT KARO users VALUES (AUTO, "Sara Ahmed", "sara@example.com", 1);
-- Multi-row insert
INSERT KARO users VALUES (2, "Ahmed", "ahmed@mail.com", 1), (3, "Zara", "zara@mail.com", 1);
-- Query with filterSELECT name, email FROM users JAHAN is_active =1;
-- AggregationSELECTCOUNT(id), AVG(age) FROM users SAMOOH DWARA is_active;
-- UpdateUPDATE users SET is_active =0 JAHAN id =1;
-- Delete
NIKALO FROM users JAHAN id =1;
Transactions
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SAVEPOINT before_update;
INSERT KARO orders VALUES (1, 100, "2024-01-01");
-- Rollback to savepoint if neededROLLBACK TO before_update;
COMMIT;
Joins
-- Inner joinSELECTusers.name, orders.totalFROM users
JOIN orders ONusers.id=orders.user_id;
-- Left join (Hinglish)SELECTusers.name, orders.totalFROM users
BAAYA MILAO orders ONusers.id=orders.user_id;
-- Explain query plan
SAMJHAO SELECT*FROM users JAHAN id >100;
Prepared Statements
PREPARE get_user ASSELECT*FROM users JAHAN id = ?;
EXECUTE get_user USING (1);
DEALLOCATE get_user;
make # Build all (CLI, server, client, test_btree)
make inventixdb # CLI tool only
make inventix-server # Server only
make inventix-client # Client only
make test_runner # Test suite runner
make clean # Remove all build artifacts
Testing
# B+ Tree unit tests
./test_btree
# Full test suite
make test-suite
# Memory management tests
make test-memory
# Network tests
make test-network-suite
# Crash recovery tests
make test-crash
# Run all tests
make test-all
# Cluster testing (manual)
make test-cluster