void wb_dbms::copy(wb_export &e, const char *fileName) { pwr_tStatus sts; char l_fileName[512]; dcli_translate_filename(l_fileName, fileName); if (!m_env) { m_env = new wb_dbms_env(l_fileName); m_env->open(); } createDb(); importVolume(e); close(); open(); try { m_env->txn_begin(0, (wb_dbms_txn **)&m_txn); wb_dbms_info i(this); i.get(m_txn); m_vid = i.vid(); m_cid = i.cid(); strcpy(m_volumeName, i.name()); commit(&sts); } catch (wb_dbms_error &e) { m_txn->abort(); printf("exeption: %s\n", e.what().c_str()); } }
void wb_db::copy(wb_export &e, const char *fileName) { pwr_tStatus sts; dcli_translate_filename(m_fileName, fileName); openDb(false); importVolume(e); close(); openDb(true); try { m_env->txn_begin(0, (DbTxn **)&m_txn, 0); wb_db_info i(this); i.get(m_txn); m_vid = i.vid(); m_cid = i.cid(); strcpy(m_volumeName, i.name()); commit(&sts); } catch (DbException &e) { //txn->abort(); printf("exeption: %s\n", e.what()); } }
void wb_dbms::copy(wb_export &e, wb_dbms_env *env) { pwr_tStatus sts; m_env = env; m_env->open(); createDb(); importVolume(e); close(); open(); try { m_env->txn_begin(0, (wb_dbms_txn **)&m_txn); wb_dbms_info i(this); i.get(m_txn); m_vid = i.vid(); m_cid = i.cid(); strcpy(m_volumeName, i.name()); commit(&sts); } catch (wb_dbms_error &e) { m_txn->abort(); printf("exeption: %s\n", e.what().c_str()); } }
bool wb_db::importVolume(wb_export &e) { try { // m_env->txn_begin(0, (DbTxn **)&m_txn, 0); // m_txn = 0; printstat(m_env, "importVolume"); e.exportHead(*this); printstat(m_env, "after head"); e.exportRbody(*this); printstat(m_env, "after rbody"); e.exportDbody(*this); printstat(m_env, "after dbody"); e.exportMeta(*this); printstat(m_env, "after meta"); // commit(&sts); // txn->commit(0); printstat(m_env, "after commit"); // m_env->txn_checkpoint(0, 0, 0); printstat(m_env, "after checkpoint"); return true; } catch (DbException &e) { printstat(m_env, "after exception"); // m_txn->abort(); printf("exeption: %s\n", e.what()); printstat(m_env, "after abort"); return false; } }
bool wb_dbms::importVolume(wb_export &e) { try { e.exportHead(*this); e.exportRbody(*this); e.exportDbody(*this); e.exportMeta(*this); return true; } catch (wb_dbms_error &e) { printf("exeption: %s\n", e.what().c_str()); return false; } }