| 347 | |
| 348 | |
| 349 | static int id2db_url(int id, int require_raw_query, int is_async, |
| 350 | struct db_url** url) |
| 351 | { |
| 352 | |
| 353 | *url = get_db_url((unsigned int)id); |
| 354 | if (*url==NULL) { |
| 355 | LM_ERR("no db_url with id <%d>\n", id); |
| 356 | return E_CFG; |
| 357 | } |
| 358 | |
| 359 | /* |
| 360 | * Since mod_init() is run before function fixups, all DB structs |
| 361 | * are initialized and all DB capabilities are populated |
| 362 | */ |
| 363 | if (require_raw_query && !DB_CAPABILITY((*url)->dbf, DB_CAP_RAW_QUERY)) { |
| 364 | LM_ERR("driver for DB URL [%u] does not support raw queries\n", |
| 365 | (unsigned int)id); |
| 366 | return -1; |
| 367 | } |
| 368 | |
| 369 | if (is_async && !DB_CAPABILITY((*url)->dbf, DB_CAP_ASYNC_RAW_QUERY)) |
| 370 | LM_WARN("async() calls for DB URL [%u] will work " |
| 371 | "in normal mode due to driver limitations\n", |
| 372 | (unsigned int)id); |
| 373 | |
| 374 | return 0; |
| 375 | } |
| 376 | |
| 377 | |
| 378 | static int fixup_db_url(void ** param) |
no test coverage detected