Commit a611129e authored by claes's avatar claes

Bugfix in new_oid, nextoix wasn't updated

parent 330fc5ab
/*
* Proview $Id: wb_db.cpp,v 1.36 2006-12-10 14:34:13 lw Exp $
* Proview $Id: wb_db.cpp,v 1.37 2007-10-25 11:08:42 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1136,6 +1136,21 @@ pwr_tOid wb_db::new_oid(wb_db_txn *txn, pwr_tOid oid)
try {
wb_db_ohead o(this, txn, woid);
} catch (DbException &e) {
pwr_tOix nextoix;
int rc = 0;
pwr_tOid oid = pwr_cNOid;
oid.vid = m_vid;
wb_db_rbody b(this, oid);
rc = b.get(txn, offsetof(pwr_sRootVolume, NextOix), sizeof(pwr_tOix), &nextoix);
if (rc)
printf("wb_db::new_oid, b.get, rc %d\n", rc);
if ( nextoix < woid.oix + 1)
nextoix = woid.oix + 1;
rc = b.put(txn, offsetof(pwr_sRootVolume, NextOix), sizeof(pwr_tOix), &nextoix);
if (rc)
printf("wb_db::new_oid, b.put, rc %d\n", rc);
return woid;
}
cout << " Old oix found, force new " << woid.oix << " !\n";
......
/*
* Proview $Id: wb_dbms.cpp,v 1.1 2007-10-18 09:11:01 claes Exp $
* Proview $Id: wb_dbms.cpp,v 1.2 2007-10-25 11:13:22 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -333,6 +333,21 @@ pwr_tOid wb_dbms::new_oid(wb_dbms_txn *txn, pwr_tOid oid)
try {
wb_dbms_ohead o(this, txn, woid);
} catch (wb_dbms_error &e) {
pwr_tOix nextoix;
int rc = 0;
pwr_tOid oid = pwr_cNOid;
oid.vid = m_vid;
wb_dbms_rbody b(this, oid);
rc = b.get(txn, offsetof(pwr_sRootVolume, NextOix), sizeof(pwr_tOix), &nextoix);
if (rc)
printf("wb_db::new_oid, b.get, rc %d\n", rc);
if ( nextoix < woid.oix + 1)
nextoix = woid.oix + 1;
rc = b.upd(txn, offsetof(pwr_sRootVolume, NextOix), sizeof(pwr_tOix), &nextoix);
if (rc)
printf("wb_dbms::new_oid, b.upd, rc %d\n", rc);
return woid;
}
cout << " Old oix found, force new " << woid.oix << " !\n";
......
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