I just want to create alternative of SQL like DBMS. For example my own PostgreSQL, but simpler and lighter. I want use this DBMS on embended systems like STM32F103C6T8 or Arduino NANO.
Also this project can be launched on Windows, MacOS (ARM / Intel), and Linux (Ubuntu, Debiand and Fedora tested).
OS | Size (bytes) |
---|---|
Ubuntu 24.04.1 | 34488 |
Fedora 40 | 35536 |
Windows 10 22H2 | 37376 |
MacOSX 10.15.7 | 87064 |
Rows count | Insert time (sec.) | Get time (sec.) |
---|---|---|
1000 | 1.8628 | 0.002097 |
5000 | 8.9934 | 0.001761 |
10000 | 18.4760 | 0.001736 |
- STM32 brunch (Complete)
- Reach 40 KB size (Complete)
- Test on hardware
CREATE
Create function template:
create database <db_name>
<db_name> create table <tb_name> <rwd> columns ( <col_name> <size> <str/int/any/"<module_name>=args,<mpre/mpost/both>"> <p/np> <a/na> ... )
Create function examples:
create database db
db create table table_1 000 columns ( col1 10 str is_primary na col2 10 any np na )
db create table table_1 000 columns ( col1 10 calc=col2*10,mpre is_primary na col2 10 any np na )
db create table table_1 000 columns ( uid 5 int p a name 8 str np na password 8 "hash=password 8,mpre" np na )
APPEND
Append function template:
Note: This function take solid string without any separators for columns.
<db_name> append row <tb_name> values <data>
Append function example:
db append row table_1 values "hello second col"
UPDATE
Update function template:
<db_name> update row <tb_name> by_index <index> values <new_data>
<db_name> update row <tb_name> by_value column <col_name> value <value> values <new_data>
Update function example:
db update row table_1 by_index 0 "goodbye hello bye"
db update row table_1 by_value column col1 value "goodbye" values "goodbye hello bye"
GET
Get function template:
<db_name> get row <tb_name> by_index <index>
<db_name> get row <tb_name> by_exp column <col_name> <expression (</>/!=/=/eq/neq)> <value> limit <count>
Get function example:
db get row table_1 by_index 0
db get row table_1 by_exp column col2 "!=" "100"
db get row table_1 by_exp column col2 "eq" "hello world"
P.S. eq and neq will compare strings, instead converting data to int.
P.P.S. Limit is optional. Providing -1 to limit will return all entries.
DELETE
Delete function template:
<db_name> delete database
<db_name> delete table <tb_name>
<db_name> delete row <tb_name> by_index <index>
<db_name> delete row <tb_name> by_exp column <col_name> <expression (</>/!=/=/eq/neq)> <value> (<eq> and <neq> will compare char*, instead converting data to int)
Delete function example:
delete database db
db delete table table_1
db delete row table_1 by_index 0
db delete row table_1 by_exp column col2 "eq" "hello world"
MIGRATE
Migrate function template:
<db_name> migrate <src_table_name> <dst_table_name> nav ( ... )
Migrate function example:
db migrate table_1 table_2 nav ( 0 1 1 3 4 2 )
P.S. In breckets placed navigation of columns. This means next:
- 0-index columns will transfer data to 1-index column from destination table.
- 1-index columns will transfer data to 3-index column from destination table.
- 4-index columns will transfer data to 2-index column from destination table.
SYNC
Sync function template:
<db_name> sync
Sync function example:
db sync
ROLLBACK
Rollback function template:
<db_name> rollback
Rollback function example:
db rollback