Just a domestic database written in Java (WIP).
Syntax:
add %table_name% %columns_definition%
Samples:
add my_table [id INTEGER] [my_col STRING]
add anotherone [id INTEGER] [my_col STRING] [col STRING] [my STRING]
add table [id INTEGER]
Syntax:
show %table_name%
Samples:
show my_table
Syntax:
put %table_name% %column_list% %data%
Samples:
put my_table [id my_col another_col] [25 somestring "some string"]
put my_table [id] [25]
put users [name] ["David"]
put users [name] [David]
Syntax:
get %table_name%
get %table_name% %conditions% where %placeholders%
Samples:
get my_table
get users [id = :id] where [:id = 1]
get customers [age > :age & city = :city] where [:age = 20 & :city = London]
get users [id > :id | name = :name] where [:name = "John" & :id = 50]
Syntax:
delete %table_name%
delete %table_name% %conditions% where %placeholders%
Samples:
delete my_table
delete users [id = :id] where [:id = 1]
delete customers [age > :age & city = :city] where [:age = 20 & :city = London]
delete users [id > :id | name = :name] where [:name = "John" & :id = 50]
xstdb utilizes two files to store data: %table%.dat and %table%.def. The first one contains records, the latter - table's definition.
purpose | type | bytes taken |
---|---|---|
table definition (file size) | SHORT INT | 2 bytes |
rows count | INTEGER | 4 bytes |
table name's length | INTEGER | 4 bytes |
table name | STRING | ? bytes |
number of columns | BYTE | 1 byte |
column 1: name's length | INTEGER | 4 bytes |
column 1: name | STRING | ? bytes |
column 1: type | BYTE | 1 byte |
column 1: size | INTEGER | 4 bytes |
column 2: name's length | INTEGER | 4 bytes |
column 2: name | STRING | ? bytes |
column 2: type | BYTE | 1 byte |
column 2: size | INTEGER | 4 bytes |
................ | ........ | ....... |