Skip to content

skapaflow/myddb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Domestic Database

MyDDB is a simple database management system write in C, created to be small, it's very useful in projects with non-sensitive data, because the data is stored in a flat-file with only rows and columns. using a relational database model, and basic commands CRUD-based (Create Read Update Delete).

MyDDB code is portable for Linux and Windows.


Building

MyDDB is self-contained in two files: myddb.h and myddb.c To use MyDDB, simply add those two files to your project.

Example Code

Sintax

It's a very simple sintax, has just two elements: (a "command" followed by an "argument") some commands has no argument.

Some examples:

PATH "../base"  #set a directory path
FROM "data"     #set a database
PRINT 1         #print in long format
EXCLUDE "data"  #explude a database
CREATE "data"   #create a database (file: data.ddb)
SHOW            #show database files
VER             #show myddb version
HELP            #show help commands

Usage

myddb main function it's like printf in c.

myddb_open();
int value = 1;
myddb("FROM helloworld PRINT %d", value);
myddb_close();

output

+--+-----+-----+
|id| name| time|
+--+-----+-----+
| 0|Alice| AD 1|
| 1|  Bob| 1 BC|
+--+-----+-----+

Data Structure

  • The data in MyDDB file, are divided in two non-printable ASCII characters.
DEC HEX CHARACTER
3 3 END OF TEXT (ETX)
29 1D GROUP SEPARATOR (GS) LEFT ARROW
  • Inside helloworld.ddb file, you'll see this.
id GS name GS time ETX 0 GS Alice GS AD 1 ETX 1 GS Bob GS 1 BC ETX

Tests

License

The code of MyDDB is licensed under MIT License.

About

myddb source tree

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published