|
@@ -47,11 +47,11 @@ int bind_dbmod(char* mod, db_func_t* mydbf)
|
|
|
db_func_t dbf;
|
|
|
|
|
|
if (!mod) {
|
|
|
- LOG(L_CRIT, "BUG: bind_dbmod(): null database module name\n");
|
|
|
+ LM_CRIT("null database module name\n");
|
|
|
return -1;
|
|
|
}
|
|
|
if (mydbf==0) {
|
|
|
- LOG(L_CRIT, "BUG: bind_dbmod(): null dbf parameter\n");
|
|
|
+ LM_CRIT("null dbf parameter\n");
|
|
|
return -1;
|
|
|
}
|
|
|
/* for safety we initialize mydbf with 0 (this will cause
|
|
@@ -64,7 +64,7 @@ int bind_dbmod(char* mod, db_func_t* mydbf)
|
|
|
len = p - mod;
|
|
|
tmp = (char*)pkg_malloc(len + 1);
|
|
|
if (!tmp) {
|
|
|
- LOG(L_ERR, "ERROR: bind_dbmod(): No memory left\n");
|
|
|
+ LM_ERR("no private memory left\n");
|
|
|
return -1;
|
|
|
}
|
|
|
memcpy(tmp, mod, len);
|
|
@@ -78,21 +78,21 @@ int bind_dbmod(char* mod, db_func_t* mydbf)
|
|
|
/* All modules must export db_use_table */
|
|
|
dbf.use_table = (db_use_table_f)find_mod_export(tmp, "db_use_table", 2, 0);
|
|
|
if (dbf.use_table == 0) {
|
|
|
- LOG(L_ERR, "bind_dbmod: Module %s does not export db_use_table function\n", tmp);
|
|
|
+ LM_ERR("module %s does not export db_use_table function\n", tmp);
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
|
/* All modules must export db_init */
|
|
|
dbf.init = (db_init_f)find_mod_export(tmp, "db_init", 1, 0);
|
|
|
if (dbf.init == 0) {
|
|
|
- LOG(L_ERR, "bind_dbmod: Module %s does not export db_init function\n", tmp);
|
|
|
+ LM_ERR("module %s does not export db_init function\n", tmp);
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
|
/* All modules must export db_close */
|
|
|
dbf.close = (db_close_f)find_mod_export(tmp, "db_close", 2, 0);
|
|
|
if (dbf.close == 0) {
|
|
|
- LOG(L_ERR, "bind_dbmod: Module %s does not export db_close function\n", tmp);
|
|
|
+ LM_ERR("module %s does not export db_close function\n", tmp);
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
@@ -118,7 +118,7 @@ int bind_dbmod(char* mod, db_func_t* mydbf)
|
|
|
dbf.free_result = (db_free_result_f)find_mod_export(tmp, "db_free_result", 2, 0);
|
|
|
if ((dbf.cap & (DB_CAP_QUERY | DB_CAP_RAW_QUERY))
|
|
|
&& (dbf.free_result == 0)) {
|
|
|
- LOG(L_ERR, "bind_dbmod: Module %s supports queries but does not export free_result function\n", tmp);
|
|
|
+ LM_ERR("module %s supports queries but does not export free_result function\n", tmp);
|
|
|
goto err;
|
|
|
}
|
|
|
|
|
@@ -175,12 +175,12 @@ int table_version(db_func_t* dbf, db_con_t* connection, const str* table)
|
|
|
int ret;
|
|
|
|
|
|
if (!dbf||!connection || !table) {
|
|
|
- LOG(L_CRIT, "BUG: table_version(): Invalid parameter value\n");
|
|
|
+ LM_CRIT("invalid parameter value\n");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
if (dbf->use_table(connection, VERSION_TABLE) < 0) {
|
|
|
- LOG(L_ERR, "table_version(): Error while changing table\n");
|
|
|
+ LM_ERR("error while changing table\n");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -193,18 +193,18 @@ int table_version(db_func_t* dbf, db_con_t* connection, const str* table)
|
|
|
col[0] = VERSION_COLUMN;
|
|
|
|
|
|
if (dbf->query(connection, key, 0, val, col, 1, 1, 0, &res) < 0) {
|
|
|
- LOG(L_ERR, "table_version(): Error in db_query\n");
|
|
|
+ LM_ERR("error in db_query\n");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
if (RES_ROW_N(res) == 0) {
|
|
|
- DBG("table_version(): No row for table %.*s found\n",
|
|
|
+ LM_DBG("no row for table %.*s found\n",
|
|
|
table->len, ZSW(table->s));
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
if (RES_ROW_N(res) != 1) {
|
|
|
- LOG(L_ERR, "table_version(): Invalid number of rows received:"
|
|
|
+ LM_ERR("invalid number of rows received:"
|
|
|
" %d, %.*s\n", RES_ROW_N(res), table->len, ZSW(table->s));
|
|
|
dbf->free_result(connection, res);
|
|
|
return -1;
|
|
@@ -212,7 +212,7 @@ int table_version(db_func_t* dbf, db_con_t* connection, const str* table)
|
|
|
|
|
|
ver = ROW_VALUES(RES_ROWS(res));
|
|
|
if ( VAL_TYPE(ver)!=DB_INT || VAL_NULL(ver) ) {
|
|
|
- LOG(L_ERR, "table_version(): Invalid type (%d) or nul (%d) version "
|
|
|
+ LM_ERR("invalid type (%d) or nul (%d) version "
|
|
|
"columns for %.*s\n", VAL_TYPE(ver), VAL_NULL(ver),
|
|
|
table->len, ZSW(table->s));
|
|
|
dbf->free_result(connection, res);
|