MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / init_lb_db

Function init_lb_db

modules/load_balancer/lb_db.c:84–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83
84int init_lb_db(const str *db_url, char *table)
85{
86 /* Find a database module */
87 if (db_bind_mod(db_url, &lb_dbf) < 0){
88 LM_ERR("Unable to bind to a database driver\n");
89 return -1;
90 }
91
92 if (lb_connect_db(db_url)!=0){
93 LM_ERR("unable to connect to the database\n");
94 return -1;
95 }
96
97 if (table) {
98 lb_table_name.s = table;
99 lb_table_name.len = strlen(table);
100 }
101
102 if(db_check_table_version(&lb_dbf, lb_db_handle,
103 &lb_table_name, LB_TABLE_VERSION) < 0) {
104 LM_ERR("error during table version check.\n");
105 return -1;
106 }
107
108 return 0;
109}
110
111
112int lb_db_load_data( struct lb_data *data)

Callers 1

mod_initFunction · 0.85

Calls 3

db_bind_modFunction · 0.85
lb_connect_dbFunction · 0.85
db_check_table_versionFunction · 0.85

Tested by

no test coverage detected