| 297 | |
| 298 | |
| 299 | static int sqlops_init(void) |
| 300 | { |
| 301 | LM_DBG("initializing...\n"); |
| 302 | |
| 303 | db_table.len = strlen(db_table.s); |
| 304 | uuid_col.len = strlen(uuid_col.s); |
| 305 | attribute_col.len = strlen(attribute_col.s); |
| 306 | value_col.len = strlen(value_col.s); |
| 307 | type_col.len = strlen(type_col.s); |
| 308 | username_col.len = strlen(username_col.s); |
| 309 | domain_col.len = strlen(domain_col.s); |
| 310 | |
| 311 | default_db_url = get_default_db_url(); |
| 312 | if (default_db_url==NULL) { |
| 313 | if (db_default_url==NULL) { |
| 314 | LM_ERR("no DB URL provision into the module!\n"); |
| 315 | return -1; |
| 316 | } |
| 317 | /* if nothing explicitly set as DB URL, add automatically |
| 318 | * the default DB URL */ |
| 319 | if (add_db_url(STR_PARAM, db_default_url)!=0) { |
| 320 | LM_ERR("failed to use the default DB URL!\n"); |
| 321 | return -1; |
| 322 | } |
| 323 | default_db_url = get_default_db_url(); |
| 324 | if (default_db_url==NULL) { |
| 325 | LM_BUG("Really ?!\n"); |
| 326 | return -1; |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | /* bind to the DB module */ |
| 331 | if (sqlops_db_bind()<0) |
| 332 | goto error; |
| 333 | |
| 334 | init_store_avps(db_columns); |
| 335 | |
| 336 | return 0; |
| 337 | error: |
| 338 | return -1; |
| 339 | } |
| 340 | |
| 341 | |
| 342 | static int sqlops_child_init(int rank) |
nothing calls this directly
no test coverage detected