MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / db_check_table_version

Function db_check_table_version

db/db.c:468–492  ·  view source on GitHub ↗

* Check the table version * 0 means ok, -1 means an error occurred */

Source from the content-addressed store, hash-verified

466 * 0 means ok, -1 means an error occurred
467 */
468int db_check_table_version(db_func_t* dbf, db_con_t* dbh, const str* table, const unsigned int version)
469{
470 int ver;
471
472 /* if DB does not support QUERY, return TRUE */
473 if (!DB_CAPABILITY(*dbf, DB_CAP_QUERY))
474 return 0;
475
476 ver = db_table_version(dbf, dbh, table);
477 if (ver < 0) {
478 if (ver == -2) {
479 LM_ERR("'%.*s' record not found in '%s' table, expected ver %d\n",
480 table->len, table->s, db_version_table, version);
481 return -2;
482 }
483
484 LM_ERR("querying version for table %.*s\n", table->len, table->s);
485 return -1;
486 } else if (ver != version) {
487 LM_ERR("invalid version %d for table %.*s found, expected %d\n",
488 ver, table->len, table->s, version);
489 return -1;
490 }
491 return 0;
492}
493
494/*
495 * Store name of table that will be used by

Callers 15

load_infoFunction · 0.85
init_address_partFunction · 0.85
tcp_reload_pathsFunction · 0.85
dbcache_new_connectionFunction · 0.85
mod_initFunction · 0.85
init_ds_dbFunction · 0.85
mod_initFunction · 0.85
init_lb_dbFunction · 0.85
mod_initFunction · 0.85
mod_initFunction · 0.85
qr_check_dbFunction · 0.85
init_reg_dbFunction · 0.85

Calls 1

db_table_versionFunction · 0.85

Tested by

no test coverage detected