| 82 | |
| 83 | |
| 84 | int 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 | |
| 112 | int lb_db_load_data( struct lb_data *data) |
no test coverage detected