Commit c2327079 authored by lw's avatar lw

Implemented wb_vrepdb::exportTree

parent 639f0163
......@@ -1170,6 +1170,60 @@ bool wb_vrepdb::exportMeta(wb_import &i)
}
bool wb_vrepdb::exportTree(wb_treeimport &i, pwr_tOid oid)
{
return exportTreeHelper(i, oid, true);
}
bool wb_vrepdb::exportTreeHelper(wb_treeimport &i, pwr_tOid oid, bool isRoot)
{
m_ohead.get(m_db->m_txn, oid);
void *rbody = 0;
void *dbody = 0;
int rbSize = m_ohead.rbSize();
int dbSize = m_ohead.dbSize();
if (rbSize) {
rbody = (void *)malloc(rbSize);
wb_db_rbody rb(m_db, oid);
int rc = rb.get(m_db->m_txn, 0, rbSize, rbody);
if (rc)
printf("wb_vrepdbs::exportTreeObject, rb.get: %d\n", rc);
}
if (dbSize) {
dbody = (void *)malloc(dbSize);
wb_db_dbody db(m_db, oid);
int rc = db.get(m_db->m_txn, 0, dbSize, dbody);
if (rc)
printf("wb_vrepdbs::exportTreeObject, db.get: %d\n", rc);
}
pwr_mClassDef flags; flags.m = 0; // Fix !!!
if (isRoot) {
i.importTreeObject(m_merep, m_ohead.oid(), m_ohead.cid(), pwr_cNOid, pwr_cNOid, m_ohead.name(), flags,
m_ohead.rbSize(), m_ohead.dbSize(), rbody, dbody);
} else {
i.importTreeObject(m_merep, m_ohead.oid(), m_ohead.cid(), m_ohead.poid(), m_ohead.boid(), m_ohead.name(), flags,
m_ohead.rbSize(), m_ohead.dbSize(), rbody, dbody);
}
if (rbSize)
free(rbody);
if (dbSize)
free(dbody);
oid = m_ohead.foid();
while (cdh_ObjidIsNotNull(oid)) {
exportTreeHelper(i, oid, false);
m_ohead.get(m_db->m_txn, oid);
oid = m_ohead.aoid();
}
return true;
}
wb_orepdb *wb_vrepdb::new_wb_orepdb(size_t size)
{
wb_orepdb *o = (wb_orepdb *) calloc(1, size);
......
......@@ -169,7 +169,8 @@ public:
virtual bool exportMeta(wb_import &e);
virtual bool exportTree(wb_treeimport &i, pwr_tOid oid) { return false;}
virtual bool exportTree(wb_treeimport &i, pwr_tOid oid);
bool exportTreeHelper(wb_treeimport &i, pwr_tOid oid, bool isRoot);
virtual bool importTree(bool keepref) { return false;}
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment