Commit d436e67e authored by Claes Sjofors's avatar Claes Sjofors

Problem with incrementation of next cix and next oix for classvolumes in database fixed

parent 3573321f
......@@ -50,14 +50,15 @@ protected:
pwr_tVid m_vid;
pwr_tCid m_cid;
vector<wb_srep*> m_srep;
int m_no_nix_incr;
public:
virtual ~wb_vrep() {};
wb_vrep() : m_vid(pwr_cNVid), m_cid(pwr_cNCid) {}
wb_vrep(pwr_tVid vid) : m_vid(vid), m_cid(pwr_cNCid) {}
wb_vrep(pwr_tVid vid, pwr_tCid cid) : m_vid(vid), m_cid(cid) {}
wb_vrep() : m_vid(pwr_cNVid), m_cid(pwr_cNCid), m_no_nix_incr(0) {}
wb_vrep(pwr_tVid vid) : m_vid(vid), m_cid(pwr_cNCid), m_no_nix_incr(0) {}
wb_vrep(pwr_tVid vid, pwr_tCid cid) : m_vid(vid), m_cid(cid), m_no_nix_incr(0) {}
virtual void unref() = 0;
virtual wb_vrep *ref() = 0;
......@@ -167,6 +168,7 @@ public:
void removeSrep( wb_srep *srep);
wb_srep *srep( pwr_tStatus *sts);
wb_srep *nextSrep( pwr_tStatus *sts, wb_srep* srep);
void noNixIncr( int incr) { m_no_nix_incr = incr;}
virtual const char *fileName() = 0;
virtual bool time( pwr_tTime *t) { return false;}
......
......@@ -106,7 +106,11 @@ wb_orep *wb_vrepced::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
strcpy( name_str, name.object());
wb_name n( name_str);
if ( soix)
m_vrep->noNixIncr( 1);
wb_orep *o = m_vrep->createObject( sts, cdef, d, n, soix);
if ( soix)
m_vrep->noNixIncr( 0);
if ( ODD(*sts))
setFlagsNewAttribute( sts, o);
......@@ -141,7 +145,11 @@ wb_orep *wb_vrepced::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destin
wb_name n( name_str);
if ( soix)
m_vrep->noNixIncr( 1);
wb_orep *o = m_vrep->copyObject( sts, orep, d, n, soix);
if ( soix)
m_vrep->noNixIncr( 0);
if ( ODD(*sts))
setFlagsNewAttribute( sts, o);
......@@ -652,8 +660,14 @@ bool wb_vrepced::importPasteObject(pwr_tOid destination, ldh_eDest destcode,
if ( po)
po->unref();
return m_vrep->importPasteObject( destination, destcode, keepoid, oid, cid, poid, boid,
if ( woidl.oix != oid.oix)
m_vrep->noNixIncr( 1);
bool rsts = m_vrep->importPasteObject( destination, destcode, keepoid, oid, cid, poid, boid,
name, flags, rbSize, dbSize, rbody, dbody, woidl, roid);
if ( woidl.oix != oid.oix)
m_vrep->noNixIncr( 0);
return rsts;
}
bool wb_vrepced::classeditorCheck( ldh_eDest dest_code, wb_orep *dest, pwr_tCid cid,
......@@ -782,7 +796,7 @@ bool wb_vrepced::classeditorCheck( ldh_eDest dest_code, wb_orep *dest, pwr_tCid
}
case pwr_eClass_ClassDef: {
// Child to ClassHier, oix from cix
pwr_tOix cix;
pwr_tOix cix = 0;
if ( !fth || fth->cid() != pwr_eClass_ClassHier) {
if ( fth)
fth->unref();
......@@ -819,7 +833,7 @@ bool wb_vrepced::classeditorCheck( ldh_eDest dest_code, wb_orep *dest, pwr_tCid
case pwr_eClass_TypeDef: {
// Child to TypeHier, oix from tix
pwr_tOix tix;
pwr_tOix tix = 0;
if ( !fth || fth->cid() != pwr_eClass_TypeHier) {
if ( fth)
fth->unref();
......@@ -951,7 +965,7 @@ bool wb_vrepced::classeditorCheck( ldh_eDest dest_code, wb_orep *dest, pwr_tCid
return false;
}
pwr_tOix aix;
pwr_tOix aix = 0;
nextAix( sts, fth, &aix);
if ( EVEN(*sts)) return false;
......
......@@ -357,7 +357,10 @@ wb_orep *wb_vrepdb::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destina
pwr_tOid woid;
woid.oix = oix;
woid.vid = m_vid;
oid = m_db->new_oid(txn, woid);
if ( !m_no_nix_incr)
oid = m_db->new_oid(txn, woid);
else
oid = woid;
if ( !oid.oix) {
*sts = LDH__BADOBJID;
return 0;
......@@ -462,7 +465,10 @@ wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
pwr_tOid woid;
woid.oix = oix;
woid.vid = m_vid;
oid = m_db->new_oid(txn, woid);
if ( !m_no_nix_incr)
oid = m_db->new_oid(txn, woid);
else
oid = woid;
if ( !oid.oix) {
*sts = LDH__BADOBJID;
return 0;
......@@ -1138,6 +1144,12 @@ wb_orep *wb_vrepdb::child(pwr_tStatus *sts, const wb_orep *orp, wb_name &name)
try {
wb_db_name n(m_db, m_db->m_txn, orp->oid(), name);
int rc = n.get(m_db->m_txn);
if (rc) {
*sts = LDH__NOSUCHOBJ;
return 0;
}
m_ohead.get(m_db->m_txn, n.oid());
return new (this) wb_orepdb(&m_ohead.m_o);
}
......@@ -1564,7 +1576,10 @@ bool wb_vrepdb::importPasteObject(pwr_tOid doid, ldh_eDest destcode,
}
if (cdh_ObjidIsNotNull( woid)) {
oep->n_oid = m_db->new_oid(m_db->m_txn, woid);
if ( !m_no_nix_incr)
oep->n_oid = m_db->new_oid(m_db->m_txn, woid);
else
oep->n_oid = woid;
if ( !oep->n_oid.oix)
oep->n_oid = m_db->new_oid(m_db->m_txn);
}
......
......@@ -364,7 +364,10 @@ wb_orep *wb_vrepdbms::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_desti
pwr_tOid woid;
woid.oix = oix;
woid.vid = m_vid;
oid = m_db->new_oid(txn, woid);
if ( !m_no_nix_incr)
oid = m_db->new_oid(txn, woid);
else
oid = woid;
if ( !oid.oix) {
*sts = LDH__BADOBJID;
return 0;
......@@ -469,7 +472,10 @@ wb_orep* wb_vrepdbms::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destinatio
pwr_tOid woid;
woid.oix = oix;
woid.vid = m_vid;
oid = m_db->new_oid(txn, woid);
if ( !m_no_nix_incr)
oid = m_db->new_oid(txn, woid);
else
oid = woid;
if ( !oid.oix) {
*sts = LDH__BADOBJID;
return 0;
......@@ -1569,7 +1575,10 @@ bool wb_vrepdbms::importPasteObject(pwr_tOid doid, ldh_eDest destcode,
}
if (cdh_ObjidIsNotNull( woid)) {
oep->n_oid = m_db->new_oid(m_db->m_txn, woid);
if ( !m_no_nix_incr)
oep->n_oid = m_db->new_oid(m_db->m_txn, woid);
else
oep->n_oid = woid;
if ( !oep->n_oid.oix)
oep->n_oid = m_db->new_oid(m_db->m_txn);
}
......
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