Example #1
0
void bdb_con_disconnect(db_con_t* con)
{
	bdb_con_t *bcon;
	bdb_uri_t *buri;

	bcon = DB_GET_PAYLOAD(con);
	buri = DB_GET_PAYLOAD(con->uri);

	if ((bcon->flags & BDB_CONNECTED) == 0) return;

	DBG("bdb: Unbinding from %s\n", buri->uri);
	if(bcon->dbp==NULL)
	{
		bcon->flags &= ~BDB_CONNECTED;
		return;
	}

	bdblib_close(bcon->dbp, &buri->path);
	bcon->dbp = 0;

	bcon->flags &= ~BDB_CONNECTED;
}
Example #2
0
/*
 * n can be the dbenv path or a table name
*/
int bdb_reload(char* _n)
{
    int rc = 0;
#ifdef BDB_EXTRA_DEBUG
    LM_DBG("[bdb_reload] Initiate RELOAD in %s\n", _n);
#endif

    if ((rc = bdblib_close(_n)) != 0)
    {   LM_ERR("[bdb_reload] Error while closing db_berkeley DB.\n");
        return rc;
    }

    if ((rc = bdblib_reopen(_n)) != 0)
    {   LM_ERR("[bdb_reload] Error while reopening db_berkeley DB.\n");
        return rc;
    }

#ifdef BDB_EXTRA_DEBUG
    LM_DBG("[bdb_reload] RELOAD successful in %s\n", _n);
#endif

    return rc;
}