[Kamailio-Devel] RFC: database interface module infrastructure

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 12 09:58:39 CEST 2008


Hello,

On 08/11/08 14:08, Henning Westerholt wrote:
> Hi all,
>
> during the refactoring of the DB API for the 1.4 release i touched a lot
> of module code. Every module that needs to connect to a DB has more or
> less the same needs:
>
> - init, connect, close the connection
> - do some versions checks
> - define some variables for e.g. column names and access handles
> - update string length for this configuration parameter in mod_init
>
> I already pushed some of this tasks like the version handling into the
> core, to unify the module behaviour, reduce code duplication and improve
> maintainability and flexibility.
>
> As this DB infrastructure stuff is not exactly the most interesting thing
> in the world to care about i just wondered if it makes sense to auto
> generate parts of it from the table XML source in db/schema. I started
> some evaluation a few weeks ago, and created some initial implementation.
> I converted the auth_db module to use this code, and did some initial
> tests.
>
>
> But before i go further in this direction i want to ask if you think that
> going this way makes sense. I've attached my proposal for autogenerated DB
> functions for the auth_db module for your review.
>
> Please let me know now your opinion,
>   
this really will help a lot. Every developers forgets to add as 
parameters the new columns he/she adds. As the example you attached 
seems to be the .c file, the .h should include external declarations of 
table and columns name, prototype for the functions that can be use 
outside of the object and a macro like MODULE_DB_PARAMETERS that will 
have the list with table and columns names in the form the module 
interface expects for including them as parameters.

As the generated files will be in repository all the time, the real 
benefits are for developers.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the Devel mailing list