--- parser3/src/main/Attic/pa_db_connection.C 2001/10/26 16:27:17 1.15 +++ parser3/src/main/Attic/pa_db_connection.C 2001/10/27 09:35:12 1.17 @@ -4,7 +4,7 @@ Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_db_connection.C,v 1.15 2001/10/26 16:27:17 paf Exp $ + $Id: pa_db_connection.C,v 1.17 2001/10/27 09:35:12 paf Exp $ */ #include "pa_config_includes.h" @@ -86,50 +86,20 @@ DB_Connection::DB_Connection(Pool& apool | DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN; - try { - // 1: trying to open with SOFT RECOVER option set - memset(&dbenv, 0, sizeof(dbenv)); - check("db_appinit soft recover", &fdb_home, db_appinit( - db_home_cstr, - db_config, - &dbenv, - flags | DB_RECOVER - )); - } catch(const Exception& e) { - if( - strncmp( - e.comment(), - DB_EXCEPTION_NO_LOG_MESSAGE1, - strlen(DB_EXCEPTION_NO_LOG_MESSAGE1))==0 || - strncmp( - e.comment(), - DB_EXCEPTION_NO_LOG_MESSAGE2, - strlen(DB_EXCEPTION_NO_LOG_MESSAGE2))==0) { - // no log = no SOFT RECOVER - // 2.1: trying to open with NO RECOVER option set - memset(&dbenv, 0, sizeof(dbenv)); - check("db_appinit no recover", &fdb_home, db_appinit( - db_home_cstr, - db_config, - &dbenv, - flags - )); - } else { - // some serious error - // 2.2: trying to open with FATAL RECOVER option set - memset(&dbenv, 0, sizeof(dbenv)); - check("db_appinit fatal recover", &fdb_home, db_appinit( - db_home_cstr, - db_config, - &dbenv, - flags | DB_RECOVER_FATAL - )); - } - } - + // trying to open with SOFT RECOVER option set + memset(&dbenv, 0, sizeof(dbenv)); + // error handlers dbenv.db_paniccall=db_paniccall; dbenv.db_errcall=db_errcall; + + // init + check("db_appinit", &fdb_home, db_appinit( + db_home_cstr, + db_config, + &dbenv, + flags + )); } DB_Connection::~DB_Connection() { @@ -202,6 +172,8 @@ void DB_Connection::clear_dbfile(const S DB_Table *DB_Connection::get_table_from_cache(const String& file_name) { SYNCHRONIZED; + maybe_expire_table_cache(); + return static_cast(table_cache.get(file_name)); }