Esempio n. 1
0
void wb_db_dbody::iter(wb_import &i)
{
  int rc = 0;

  m_db->m_t_dbody->cursor(m_db->m_txn, &m_dbc, 0);

  /* Initialize the key/data pair so the flags aren't set. */
  memset(&m_oid, 0, sizeof(m_oid));
  m_key.set_data(&m_oid);
  m_key.set_ulen(sizeof(m_oid));
  m_key.set_flags(DB_DBT_USERMEM);
  m_data.set_flags(DB_DBT_MALLOC);


  /* Walk through the database and print out the key/data pairs. */

  while (1) {

    try {
      rc = m_dbc->get(&m_key, &m_data, DB_NEXT);
    }
    catch (DbException &e) {
      printf("Exc: %s\n", e.what());
    }

    if (rc == DB_NOTFOUND)
      break;

    i.importDbody(m_oid, m_data.get_size(), m_data.get_data());
    free(m_data.get_data());
 }

  m_dbc->close();
}
Esempio n. 2
0
void wb_dbms_dbody::iter(wb_import &i)
{
    int rc = 0;

    memset(&m_oid, 0, sizeof(m_oid));

    m_data.data(m_db->m_buf);
    m_data.size(sizeof(m_db->m_buf));
    m_data.bSize(sizeof(m_db->m_buf));

    m_db->m_t_dbody->cursor(m_db->m_txn, &m_key, &m_data, &m_dbc);

    /* Walk through the database and print out the key/data pairs. */

    while (1) {

        try {
            rc = m_dbc->get();
        }
        catch (wb_dbms_error &e) {
            printf("Exc: %s\n", e.what().c_str());
        }

        if (rc != 0)
            break;

        i.importDbody(m_oid, m_data.size(), m_data.data());
    }

    m_dbc->close();
    delete m_dbc;
    m_dbc = 0;
}
Esempio n. 3
0
bool wb_vrepdbs::exportDbody(wb_import& i)
{
  dbs_sBody* bp = 0;
  pwr_tStatus sts;

  while ((bp = dbs_NextDbody(&sts, dbsenv(), bp))) {
    i.importDbody(bp->oid, bp->size, (void*)(bp + 1));
  }

  return true;
}