How hihihi-sigma/tinydb works
Tinydb is a small interactive database: the user enters meta-commands or SQL-like INSERT, SELECT, DEL, and UPDATE statements; input is parsed, dispatched, and applied to rows in a paged file-backed table. The sampled code establishes the command loop, parser, execution dispatch, table operations, and pager persistence. The where type is defined in a header; its implementation file was read but provides no additional behavior. No README was supplied, so capability coverage is based on the sampled source.
Main entry points: main.c Command Loop · table.c Row Table · parser.c Statement Parser · execute.c Statement Executor
Components 9
Interactive CLI
- Command Loop
src/main.c - Input Buffer
src/input_buffer.c
Query Processing
- Statement Parser
src/parser.c - Where Clause
src/where.c - Statement Executor
src/execute.c
Table Storage
- Row Table
src/table.c - Page Cache
src/pager.c - Database File
Other components
- User
Connections 9
- User → Command Loop: enters commands
src/main.c - Command Loop → Input Buffer: reads input
src/main.c - Command Loop → Statement Parser: parses statements
src/main.c - Statement Parser → Where Clause: sets filters
src/parser.c - Command Loop → Statement Executor: dispatches statements
src/main.c - Statement Executor → Row Table: calls row operations
src/execute.c - Row Table → Page Cache: reads and writes pages
src/table.c - Row Table → Where Clause: checks filters
src/table.c - Page Cache → Database File: loads and flushes
src/pager.c