| 501 | } |
| 502 | |
| 503 | int init_reg_db(const str *db_url) |
| 504 | { |
| 505 | /* Find a database module */ |
| 506 | if (db_bind_mod(db_url, ®_dbf) < 0) { |
| 507 | LM_ERR("Unable to bind to a database driver\n"); |
| 508 | return -1; |
| 509 | } |
| 510 | if (connect_reg_db(db_url)!=0){ |
| 511 | LM_ERR("unable to connect to the database\n"); |
| 512 | return -1; |
| 513 | } |
| 514 | if(db_check_table_version(®_dbf, reg_db_handle, |
| 515 | ®_table_name, REG_TABLE_VERSION) < 0) { |
| 516 | LM_ERR("error during table version check.\n"); |
| 517 | return -1; |
| 518 | } |
| 519 | /* Load registrants into the primary list */ |
| 520 | if(load_reg_info_from_db(REG_DB_LOAD, NULL) !=0){ |
| 521 | LM_ERR("unable to load the registrant data\n"); |
| 522 | return -1; |
| 523 | } |
| 524 | |
| 525 | reg_dbf.close(reg_db_handle); |
| 526 | reg_db_handle = NULL; |
| 527 | |
| 528 | return 0; |
| 529 | } |
| 530 | |
| 531 | |
| 532 | void destroy_reg_db(void) |
no test coverage detected