Daniel-Constantin
Mierla
FhG FOKUS
mierla@fokus.fraunhofer.de
2003
2004
FhG FOKUS
Dbtext Module
Overview
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.
Design of Dbtext Engine
The dbtext database system architecture:
A database is represented by a directory on the
local file system.
When you use "dbtext" in SER, the database URL
for modules must be the path to the directory
where the table-files are located, prefixed by
"dbtext://", e.g.,
"dbtext:///var/dbtext/ser". If there is no "/"
after "dbtext://" then "CFG_DIR/" is inserted
at the beginning of the database path. So,
either you provide an absolute path to database
directory or a relative one to "CFG_DIR"
directory.
A table is represented by a text file inside
database directory.
Installation And Running
Compile the module and load it instead of mysql or other DB
modules.
When you use dbtext in SER, the database
URL for modules must be the path to the directory where the
table-files are located, prefixed by "dbtext://", e.g.,
"dbtext:///var/dbtext/ser". If there is no "/" after
"dbtext://" then "CFG_DIR/" is inserted at the beginning of the
database path. So, either you provide an absolute path to
database directory or a relative one to "CFG_DIR" directory.
Load the dbtext module
...
loadmodule "/path/to/ser/modules/dbtext.so"
...
modparam("module_name", "db_url", "dbtext:///path/to/dbtext/database")
...
Using Dbtext With Basic SER Configuration
Here are the definitions for most important table as well as a
basic configuration file to use dbtext with SER. The table
structures may change in time and you will have to adjust
next examples.
You have to populate the table 'subscriber' by hand with user
profiles in order to have authentication. To use with the given
configuration file, the table files must be placed in the
'/tmp/serdb' directory.
Definition of 'subscriber' table (one line)
...
username(str) domn(str) password(str) first_name(str) last_name(str)
phone(str) email_address(str) datetime_created(int)
datetime_modified(int) confirmation(str) flag(str)
sendnotification(str) greeting(str) ha1(str) ha1b(str)
perms(str) allow_find(str) timezone(str,null) rpid(str,null)
uuid(str,null)
...
Definition of 'location' and 'aliases' tables (one line)
...
username(str) domain(str,null) contact(str,null) expires(int,null)
q(double,null) callid(str,null) cseq(int,null)
last_modified(str) replicate(int,null) state(int,null)
flags(int) user_agent(str) received(str)
...
Definition of 'version' table and sample records
...
table_name(str) table_version(int) subscriber:3 location:6 aliases:6
...
Configuration file