kcplantdb.h | kcplantdb.h | |||
---|---|---|---|---|
skipping to change at line 3295 | skipping to change at line 3295 | |||
if (!dump_meta()) err = true; | if (!dump_meta()) err = true; | |||
return !err; | return !err; | |||
} | } | |||
/** | /** | |||
* Reorganize the database file. | * Reorganize the database file. | |||
* @param mode the connection mode of the internal database. | * @param mode the connection mode of the internal database. | |||
* @return true on success, or false on failure. | * @return true on success, or false on failure. | |||
*/ | */ | |||
bool reorganize_file(uint32_t mode) { | bool reorganize_file(uint32_t mode) { | |||
_assert_(true); | _assert_(true); | |||
if (!load_meta()) return false; | if (!load_meta()) { | |||
if (reccomp_.comp) { | ||||
linkcomp_.comp = reccomp_.comp; | ||||
} else { | ||||
reccomp_.comp = &LEXICALCOMP; | ||||
linkcomp_.comp = &LEXICALCOMP; | ||||
} | ||||
} | ||||
const std::string& path = db_.path(); | const std::string& path = db_.path(); | |||
const std::string& npath = path + File::EXTCHR + PDBTMPPATHEXT; | const std::string& npath = path + File::EXTCHR + PDBTMPPATHEXT; | |||
PlantDB tdb; | PlantDB tdb; | |||
tdb.tune_comparator(reccomp_.comp); | tdb.tune_comparator(reccomp_.comp); | |||
if (!tdb.open(npath, OWRITER | OCREATE | OTRUNCATE)) { | if (!tdb.open(npath, OWRITER | OCREATE | OTRUNCATE)) { | |||
set_error(_KCCODELINE_, tdb.error().code(), "opening the destination failed"); | set_error(_KCCODELINE_, tdb.error().code(), "opening the destination failed"); | |||
return false; | return false; | |||
} | } | |||
db_.report(_KCCODELINE_, Logger::WARN, "reorganizing the database"); | db_.report(_KCCODELINE_, Logger::WARN, "reorganizing the database"); | |||
bool err = false; | bool err = false; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 8 lines changed or added | |||