Example #1
0
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;
  }
}
Example #2
0
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;
    }
}
Example #3
0
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());
    }

}
Example #4
0
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());
    }

}
Example #5
0
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());
  }

}
Example #6
0
bool
wb_dbs::importVolume(wb_export &e)
{

  e.exportHead(*this);
  buildSectName();
  checkObject(m_oep);
  buildSectOid();
  buildSectClass();
  createFile();

  return true;
}