[OpenSIPS-Users] [NEW FEATURE] Multi DB connections support in AVPOPS

Dan Pascu dan at ag-projects.com
Tue Jan 6 18:22:42 CET 2009


On Wednesday 31 December 2008, Bogdan-Andrei Iancu wrote:
> How it works:
> =============
>
> 1) define all the DB connections you want to use in AVPOPS module be
> multiple definitions of "db_url" param:
>         modparam("avpops","db_url","mysql://user:passwd@host/database")
>         modparam("avpops","db_url","1
> postgres://user:passwd@host/osips") modparam("avpops","db_url","2
> mysql://user:passwd@localhost/opensips_1_4")
> Note that the db url string is prefixed by a numerical id - a db_url
> reference number that will be used later to specify what DB connection
> to be used.
>
> 2) use it - all avp_db_xxxx function takes as optional 3rd parameter
> the db connection id. If this param is missing, the default (id 0)
> connection is to be assumed.
>
>   Ex:
>     # load using default db connection (backward compatible)
>     avp_db_load("$fu","$(i:678)");
>     # load using db connection id 2
>     avp_db_load("$fu","$(i:678)", "2");

It would be nicer if names could be used instead of numeric ids to 
identify a connection, as they are easier to remember and more user 
friendly.

-- 
Dan



More information about the Users mailing list