https://github.com/92181/hashdb
A tiny one dimensional database, written in plain C.
https://github.com/92181/hashdb
c cpp database hashmap xxhash
Last synced: 7 months ago
JSON representation
A tiny one dimensional database, written in plain C.
- Host: GitHub
- URL: https://github.com/92181/hashdb
- Owner: 92181
- License: mit
- Created: 2024-09-06T22:03:20.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-05T00:57:39.000Z (9 months ago)
- Last Synced: 2025-01-05T01:27:07.132Z (9 months ago)
- Topics: c, cpp, database, hashmap, xxhash
- Language: C
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tiny Hashmap Database
A tiny database written in plain C, I decided to write this to understand the inner-workings of databases further and familiarize myself with different hashing algoritms such as SHA256 and xxHash.
The library is consists of a single C header file which can be easily included in any C or C++ project.This hash based 'database' is thus fully embeddable and modular. Three examples are provided such as...
* Basic usage example, insert, retrieve and delete entries with their respondings keys.
* A data map switch example, switches between data maps and retrieves values.
* A disk read and write example, which allows you to store a map on the disk.# Usage
This is a basic example on how to use the small library correctly. More examples can be found in the example directory.```c
// Create A Table And Data Array;
unsigned char *j[32];dbc(j,10,200);// Insert Key And Corresponding Value;
dbi("apple","You",5,3);dbi("appena","Love",6,4);dbi("orange","Data",6,4);// Remove The Entry By The Supplied Key;
dbd("apple",5);// Retrieve Values Stored In Array By Key;
unsigned char *y,*r;dbg("apple",5,&y,&r);if(y>0){while(y0){while(y