Copyright © 2003, 2004 FhG FOKUS
The module implements a simplified database engine based on text files. It can be used by SER DB interface instead of other database module (like MySQL).
The module is meant for use in demos or small devices that do not support other DB modules. It keeps everything in memory and if you deal with large amount of data you may run quickly out of memory. Also, it has not implemented all standard database facilities (like order by), it includes minimal functionality to work properly (who knows ?!?) with SER.
The dbtext database system architecture:
a database is represented by a directory in the local file system. NOTE: when you use dbtext in SER the database URL for modules must be the path to the directory where the table-files are located, e.g., "/var/dbtext/ser". If the path to database is not absolute, then it is prefixed with "CFG_DIR/".
a table is represented by a text file inside database directory.
First line is the definition of the columns. Each column must be declared as follows:
the name of column must not include white spaces.
the format of a column definition is: name(type,attr).
the type of a column can be:
int - integer numbers.
double - real numbers with two decimals.
str - strings with maximum size of 4KB.
a column can have one of the attributes:
auto - only for 'int' columns, the maximum value in that column is incremented and stored in this field if it is not provided in queries.
null - accept null values in column fields.
if no attribute is set, the fields of the column cannot have null value.
each other line is a row with data. The line ends with "\n".
the fields are separated by ":".
no value between two ':' (or between ':' and start/end of a row) means "null" value.
next characters must be escaped in strings: "\n", "\r", "\t", ":".
0 -- the zero value must be escaped too.
Example 1-1. Sample of a dbtext table
... id(int,auto) name(str) flag(double) desc(str,null) 1:nick:0.34:a\tgood\: friend 2:cole:-3.75:colleague 3:bob:2.50: ...
The next libraries or applications must be installed before running SER with this module:
none.
Compile the module and load it instead of mysql or other DB modules.
REMINDER: when you use dbtext in SER the database URL for modules must be the path to the directory where the table-files are located, e.g., "/var/dbtext/ser". If the path to database is not absolute, then it is prefixed with "CFG_DIR/".
Once you have the module loaded, you can use the API specified by SER DB interface. Take a look at SER Developer's Guide for more information.
Take a look at http://www.iptel.org/ser/.
First at all check if your question was already answered on one of our mailing lists: SER-Users
(http://mail.iptel.org/mailman/listinfo/serusers/)
or SER-Developers
(http://mail.iptel.org/mailman/listinfo/serdev/).
Any mails regarding stable SER release must be sent to
<serusers@iptel.org>
while
<serdev@iptel.org>
must be used for under-developing
version.
If you want to keep the mail private, send it to
<serhelp@iptel.org>
.
Please follow the guidelines provided at: http://www.iptel.org/ser/bugs/.