On 21-11 03:46, Andrei Pelinescu-Onciul wrote:
Note that lib/sr_dbk includes all the history from kamailio/openser
(if you run git log on lib/sr_dbk you'll see all the commits from svn
that touched db/).
I've also created a script that automatically converts a kamailio module
to sip-router. It adds -DKAMAILIO_MOD_INTERFACE to the Makefile and if
the module uses DB, it automatically fixes all the includes and adds the
link with libsk_dbk makefile magic.
(attached, it might make sense to have it on git, but I can't think of
a good place for it)
I just commited the stuff that I created. Basically it is the same approach
as yours, except that I went a bit further and added both db api versions
as libraries.
Furthermore I took both ser and kamailio mysql modules and integrated them
into a single db_mysql module which supports both versions of the db API
and links with both libraries.
There were some conflicts in identifiers so I used the most straightforward
approach and renamed the conflicting names in the older version, for example,
db_con_t becomes db_con1_t there.
You can find it in branch janakj/db, I only took it to the state when it
compiles, this stuff is not supposed to be used or merged into the master
branch, I only commited it so that others (Henning) can take a look at it
and comment.
The renaming of some data structures and typedefs only needs to be done
in the libraries and in the database drivers that link with both libraries.
In other modules we can just typedef them to the correct version depending
on the version of the library the module is using, so there will be no need
to change the code of all modules.
This approach is quite straightforward and we can make lots of modules from
both projects work quickly with the integrated core. Eventually, after all
modules are converted to the new db api, we can drop support for the older
library and remove the old interface from database drivers.
Unless nobody objects, I would suggest we do the following:
1) Convert both API versions into libraries. Here I would suggest some
simpler name, sr_dbk sounds is cryptic, how about using just db1 and db2
possibly prefixed with sr (libsrdb1, libsrdb2)?
2) Rename conflicting identifiers in both libraries, i.e. db_con1, db_con2,
db_res1, db_res2.
2) Merge database drivers from both projects. Here I would suggest we
adopt the naming scheme from Kamailio and prefix all of them with db_.
4) Link modules that use db with one of the libraries.
Jan.