/** * Module initialization function that is called before the main process forks */ static int mod_init(void) { int ver; db_url.len = strlen(db_url.s); if (db_url.len == 0) { if (use_uri_table) { LM_ERR("configuration error - no database URL, " "but use_uri_table is set!\n"); return -1; } return 0; } db_table.len = strlen(db_table.s); uridb_user_col.len = strlen(uridb_user_col.s); uridb_domain_col.len = strlen(uridb_domain_col.s); uridb_uriuser_col.len = strlen(uridb_uriuser_col.s); if (uridb_db_bind(&db_url)) { LM_ERR("No database module found\n"); return -1; } /* Check table version */ ver = uridb_db_ver(&db_url, &db_table); if (ver < 0) { LM_ERR("Error while querying table version\n"); return -1; } else { if (use_uri_table) { if (ver != URI_TABLE_VERSION) { LM_ERR("Invalid table version of the uri table\n"); return -1; } } else { if (ver != SUBSCRIBER_TABLE_VERSION) { LM_ERR("Invalid table version of the subscriber table\n"); return -1; } } } return 0; }
/** * Module initialization function that is called before the main process forks */ static int mod_init(void) { if (db_url.len == 0) { if (use_uri_table) { LM_ERR("configuration error - no database URL, " "but use_uri_table is set!\n"); return -1; } return 0; } if (uridb_db_bind(&db_url)) { LM_ERR("No database module found\n"); return -1; } /* Check table version */ if (uridb_db_ver(&db_url) < 0) { LM_ERR("Error during database table version check"); return -1; } return 0; }