Welcome to the sourceforge site of KekeDB
To the project page
Here is an cut n' paste of KekeDB's README
4. Command Reference
5. Using client library
KekeDB is a simple database server using SQL like
query language aimed for embedded linux systems.
It's main goals are to be as tiny as possible with
minimal set of features. It is based on Berkelys
libdb1 to provide a reliable backend for saving data
We use it on a etrax 100 lx risc processor from
Axis communications. It performs pretty well with
about 10 000 records in a single table.
The size of the binary on our target system is about
20kB together with ripped down version of libdb it fits
into under 50kB. KekeDB uses only btree from db1 so
other access methods can be ripped of while porting to
All this stuff is published under GPL license.
KekeDB was designed to meet our database needs in our
embended systems. It lacks many features common in
other database systems, but I hope I will have enough
time implement most of someday.
If you find my server usefull but think that it lacks
some important features, feel free to implement them.
4. Command Reference
create: Creates a new table.
"create table tampere"
This is the first of the odd things I have
coded here. The tables lack the structure!
Every field is refered by a number. That can
be defined in client program.
(reduces the size of binaries ;-) )
Each record can have unlimited number of
records not affecting the size occupied by other
records. So you can easily save an list to a record :-)
And there are no datatypes. Except the key field that
I will explain when discussing about inserts.
Table data will be stored to /var/db
I had some problems with config files so this is
a hardcoded path. Can be hack in sqlroutines.c:138
drop: removes a table from databasesystem
"drop table tampere"
insert: Inserts some to table
"insert into tampere values (10,'matti''s pizza';'teppo')"
^ see quatation
This creates a new record with three fields.
Server makes no differens between datatypes
and records can vary in the number of fields.
Only exception to this is the key field.
Most databases include a generated key value as the
first field so for performance and tiny size I decided
to hardcode the first field to be an integer key.
insert trows an error if key exits.
set: Just like insert except the fact that if record
with same key exists it is overriden.
delete: deletes records from a table
"delete from tampere where 1 = 'matti'"
Removes record whose second field has value
'matti' in it.
** Remeber! Just like standard SQL-implementations
also kekedb will empty the whole table
if you give a delete command without a where
clouse like 'delete * from tampere' **
Usage of where clouse will be explained later.
select: picks up some records from a table
"select * from tampere where 1 = 'matti'"
This will return all records that has
the value 'matti' in the second field.
where clouse is used together with the commands
'delete' and 'select'. It is used restrict the number
of records the command effects on, like in examples
above. Unlike normal SQL, this where supports no
field names, only field numbers, only constants
allowed are string constants and reserved word 'like'
is replaced with a slightly different operator 'loves'.
Few examples will give an idea of the usage:
select * from tampere where 1 = 'matti' and 2<'teppo'
Selects from table tampere, the records with
second field 'matti' and the third field alphabetically
less than 'teppo'.
select * from tampere where 1 = 'matti' or <=100
Selects records from table tampere with first field 'matti' and third field numerically less than or
equal to 100. This has no efect to performance but
lexical and numerical orders can be different.
delete from tampere where 1 loves 'ma'
removes from table tampere records with
an occurance of string 'ma' in the second
delete from tamprea where (1 = 'matti' or 'turo' = 1) and 2<'teppo'
removes records wich has value 'matti' or 'turo'
in the second field and third field less than
Reseved words: (another of a and b is a field # another constant)
a = b: a is equal to b
a > b: a is creater than b
a < b: a is less than b
a <= b: a is less than or equal to b
a >= b: a is creater than or equal to b
a loves b: a is a substing of b
and: logical and for operators above
or: logical or for operators above
5. Using client library
To access kekedb from your c-code you
have to include sqlclient.h header file
and link libsqlc to your binary.
From your code you then call sqlquery function
that takes two string arguments. The IP address of the
server and the query to be executed and returns
a linked list of the records matching the query.
Example code see sqlclienttester.c in the tar ball.
-Thanks to John P. Looney for bugreports and makepasswd