diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp/src/FreezeScript/transformdb.cpp | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'cpp/src/FreezeScript/transformdb.cpp')
-rw-r--r-- | cpp/src/FreezeScript/transformdb.cpp | 738 |
1 files changed, 369 insertions, 369 deletions
diff --git a/cpp/src/FreezeScript/transformdb.cpp b/cpp/src/FreezeScript/transformdb.cpp index 8f17b6e8d37..b3a5a6adec4 100644 --- a/cpp/src/FreezeScript/transformdb.cpp +++ b/cpp/src/FreezeScript/transformdb.cpp @@ -96,21 +96,21 @@ findType(const Slice::UnitPtr& u, const string& type) string t; if(type == "::Ice::Object") { - t = "Object"; + t = "Object"; } else if(type == "::Ice::Object*") { - t = "Object*"; + t = "Object*"; } else { - t = type; + t = type; } l = u->lookupType(t, false); if(l.empty()) { - return 0; + return 0; } return l.front(); @@ -118,97 +118,97 @@ findType(const Slice::UnitPtr& u, const string& type) static void transformDb(bool evictor, const Ice::CommunicatorPtr& communicator, - const FreezeScript::ObjectFactoryPtr& objectFactory, - DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName, - const Freeze::ConnectionPtr& connectionNew, vector<Db*>& dbs, - const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, - DbTxn* txnNew, bool purgeObjects, bool suppress, string descriptors) + const FreezeScript::ObjectFactoryPtr& objectFactory, + DbEnv& dbEnv, DbEnv& dbEnvNew, const string& dbName, + const Freeze::ConnectionPtr& connectionNew, vector<Db*>& dbs, + const Slice::UnitPtr& oldUnit, const Slice::UnitPtr& newUnit, + DbTxn* txnNew, bool purgeObjects, bool suppress, string descriptors) { if(evictor) { - // - // The evictor database file contains multiple databases. We must first - // determine the names of those databases, ignoring any whose names - // begin with "$index:". Each database represents a separate facet, with - // the facet name used as the database name. The database named "$default" - // represents the main object. - // - vector<string> dbNames; - { - Db db(&dbEnv, 0); - db.open(0, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0); - Dbt dbKey, dbValue; - dbKey.set_flags(DB_DBT_MALLOC); - dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); - - Dbc* dbc = 0; - db.cursor(0, &dbc, 0); - - while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) - { - string s(static_cast<char*>(dbKey.get_data()), dbKey.get_size()); - if(s.find("$index:") != 0) - { - dbNames.push_back(s); - } - free(dbKey.get_data()); - } - - dbc->close(); - db.close(0); - } - - // - // Transform each database. We must delay closing the new databases - // until after the transaction is committed or aborted. - // - for(vector<string>::iterator p = dbNames.begin(); p != dbNames.end(); ++p) - { - string name = p->c_str(); - - Db db(&dbEnv, 0); - db.open(0, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); - - Db* dbNew = new Db(&dbEnvNew, 0); - dbs.push_back(dbNew); - dbNew->open(txnNew, dbName.c_str(), name.c_str(), DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); - - // - // Execute the transformation descriptors. - // - istringstream istr(descriptors); - string facet = (name == "$default" ? string("") : name); - FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0, - dbName, facet, purgeObjects, cerr, suppress, istr); - - db.close(0); - } - - Freeze::Catalog catalogNew(connectionNew, Freeze::catalogName()); - Freeze::CatalogData catalogData; - catalogData.evictor = true; - catalogNew.put(Freeze::Catalog::value_type(dbName, catalogData)); + // + // The evictor database file contains multiple databases. We must first + // determine the names of those databases, ignoring any whose names + // begin with "$index:". Each database represents a separate facet, with + // the facet name used as the database name. The database named "$default" + // represents the main object. + // + vector<string> dbNames; + { + Db db(&dbEnv, 0); + db.open(0, dbName.c_str(), 0, DB_UNKNOWN, DB_RDONLY, 0); + Dbt dbKey, dbValue; + dbKey.set_flags(DB_DBT_MALLOC); + dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); + + Dbc* dbc = 0; + db.cursor(0, &dbc, 0); + + while(dbc->get(&dbKey, &dbValue, DB_NEXT) == 0) + { + string s(static_cast<char*>(dbKey.get_data()), dbKey.get_size()); + if(s.find("$index:") != 0) + { + dbNames.push_back(s); + } + free(dbKey.get_data()); + } + + dbc->close(); + db.close(0); + } + + // + // Transform each database. We must delay closing the new databases + // until after the transaction is committed or aborted. + // + for(vector<string>::iterator p = dbNames.begin(); p != dbNames.end(); ++p) + { + string name = p->c_str(); + + Db db(&dbEnv, 0); + db.open(0, dbName.c_str(), name.c_str(), DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); + + Db* dbNew = new Db(&dbEnvNew, 0); + dbs.push_back(dbNew); + dbNew->open(txnNew, dbName.c_str(), name.c_str(), DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); + + // + // Execute the transformation descriptors. + // + istringstream istr(descriptors); + string facet = (name == "$default" ? string("") : name); + FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, 0, + dbName, facet, purgeObjects, cerr, suppress, istr); + + db.close(0); + } + + Freeze::Catalog catalogNew(connectionNew, Freeze::catalogName()); + Freeze::CatalogData catalogData; + catalogData.evictor = true; + catalogNew.put(Freeze::Catalog::value_type(dbName, catalogData)); } else { - // - // Transform a map database. - // - Db db(&dbEnv, 0); - db.open(0, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); - - Db* dbNew = new Db(&dbEnvNew, 0); - dbs.push_back(dbNew); - dbNew->open(txnNew, dbName.c_str(), 0, DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); - - // - // Execute the transformation descriptors. - // - istringstream istr(descriptors); - FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, - connectionNew, dbName, "", purgeObjects, cerr, suppress, istr); - - db.close(0); + // + // Transform a map database. + // + Db db(&dbEnv, 0); + db.open(0, dbName.c_str(), 0, DB_BTREE, DB_RDONLY, FREEZE_SCRIPT_DB_MODE); + + Db* dbNew = new Db(&dbEnvNew, 0); + dbs.push_back(dbNew); + dbNew->open(txnNew, dbName.c_str(), 0, DB_BTREE, DB_CREATE | DB_EXCL, FREEZE_SCRIPT_DB_MODE); + + // + // Execute the transformation descriptors. + // + istringstream istr(descriptors); + FreezeScript::transformDatabase(communicator, objectFactory, oldUnit, newUnit, &db, dbNew, txnNew, + connectionNew, dbName, "", purgeObjects, cerr, suppress, istr); + + db.close(0); } } @@ -263,44 +263,44 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) } catch(const IceUtil::BadOptException& e) { - cerr << argv[0] << ": " << e.reason << endl; - usage(argv[0]); - return EXIT_FAILURE; + cerr << argv[0] << ": " << e.reason << endl; + usage(argv[0]); + return EXIT_FAILURE; } if(opts.isSet("help")) { - usage(argv[0]); - return EXIT_SUCCESS; + usage(argv[0]); + return EXIT_SUCCESS; } if(opts.isSet("version")) { - cout << ICE_STRING_VERSION << endl; - return EXIT_SUCCESS; + cout << ICE_STRING_VERSION << endl; + return EXIT_SUCCESS; } if(opts.isSet("D")) { - vector<string> optargs = opts.argVec("D"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldCppArgs += " -D" + *i; - newCppArgs += " -D" + *i; - } + vector<string> optargs = opts.argVec("D"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + oldCppArgs += " -D" + *i; + newCppArgs += " -D" + *i; + } } if(opts.isSet("U")) { - vector<string> optargs = opts.argVec("U"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldCppArgs += " -U" + *i; - newCppArgs += " -U" + *i; - } + vector<string> optargs = opts.argVec("U"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + oldCppArgs += " -U" + *i; + newCppArgs += " -U" + *i; + } } debug = opts.isSet("debug"); if(opts.isSet("o")) { - outputFile = opts.optArg("o"); + outputFile = opts.optArg("o"); } ignoreTypeChanges = opts.isSet("i"); purgeObjects = opts.isSet("p"); @@ -308,102 +308,102 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) suppress = opts.isSet("w"); if(opts.isSet("f")) { - inputFile = opts.optArg("f"); + inputFile = opts.optArg("f"); } if(opts.isSet("include-old")) { - vector<string> optargs = opts.argVec("include-old"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldCppArgs += " -I" + *i; - } + vector<string> optargs = opts.argVec("include-old"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + oldCppArgs += " -I" + *i; + } } if(opts.isSet("include-new")) { - vector<string> optargs = opts.argVec("include-new"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - newCppArgs += " -I" + *i; - } + vector<string> optargs = opts.argVec("include-new"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + newCppArgs += " -I" + *i; + } } if(opts.isSet("old")) { - vector<string> optargs = opts.argVec("old"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - oldSlice.push_back(*i); - } + vector<string> optargs = opts.argVec("old"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + oldSlice.push_back(*i); + } } if(opts.isSet("new")) { - vector<string> optargs = opts.argVec("new"); - for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) - { - newSlice.push_back(*i); - } + vector<string> optargs = opts.argVec("new"); + for(vector<string>::const_iterator i = optargs.begin(); i != optargs.end(); ++i) + { + newSlice.push_back(*i); + } } evictor = opts.isSet("e"); if(opts.isSet("key")) { - keyTypeNames = opts.optArg("key"); + keyTypeNames = opts.optArg("key"); } if(opts.isSet("value")) { - valueTypeNames = opts.optArg("value"); + valueTypeNames = opts.optArg("value"); } caseSensitive = opts.isSet("case-sensitive"); if(outputFile.empty()) { - if(args.size() == 2) - { - allDb = true; - } - else if(args.size() != 3) - { - usage(argv[0]); - return EXIT_FAILURE; - } + if(args.size() == 2) + { + allDb = true; + } + else if(args.size() != 3) + { + usage(argv[0]); + return EXIT_FAILURE; + } } else { - if(args.size() == 1) - { - allDb = true; - } - else if(args.size() != 0) - { - usage(argv[0]); - return EXIT_FAILURE; - } + if(args.size() == 1) + { + allDb = true; + } + else if(args.size() != 0) + { + usage(argv[0]); + return EXIT_FAILURE; + } } if(allDb && (!keyTypeNames.empty() || !valueTypeNames.empty())) { - usage(argv[0]); - return EXIT_FAILURE; + usage(argv[0]); + return EXIT_FAILURE; } if(inputFile.empty() && !allDb && !evictor && (keyTypeNames.empty() || valueTypeNames.empty())) { - usage(argv[0]); - return EXIT_FAILURE; + usage(argv[0]); + return EXIT_FAILURE; } if(args.size() > 0) { - dbEnvName = args[0]; + dbEnvName = args[0]; } if(args.size() > 1) { - if(allDb) - { - dbEnvNameNew = args[1]; - } - else - { - dbName = args[1]; - } + if(allDb) + { + dbEnvNameNew = args[1]; + } + else + { + dbName = args[1]; + } } if(args.size() > 2) { @@ -436,20 +436,20 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) FreezeScript::CatalogDataMap catalog; if(allDb) { - try - { - catalog = FreezeScript::readCatalog(communicator, dbEnvName); - } - catch(const FreezeScript::FailureException& ex) - { - cerr << argv[0] << ": " << ex.reason() << endl; - return EXIT_FAILURE; - } - if(catalog.empty()) - { - cerr << argv[0] << ": no databases in environment `" << dbEnvName << "'" << endl; - return EXIT_FAILURE; - } + try + { + catalog = FreezeScript::readCatalog(communicator, dbEnvName); + } + catch(const FreezeScript::FailureException& ex) + { + cerr << argv[0] << ": " << ex.reason() << endl; + return EXIT_FAILURE; + } + if(catalog.empty()) + { + cerr << argv[0] << ": no databases in environment `" << dbEnvName << "'" << endl; + return EXIT_FAILURE; + } } // @@ -463,166 +463,166 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) vector<string> missingTypes; vector<string> analyzeErrors; - FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors); - - const string evictorKeyName = "::Ice::Identity"; - const string evictorValueName = "::Freeze::ObjectRecord"; - - if(allDb) - { - // - // Add a <database> element for each database in the catalog. - // - for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) - { - string keyName, valueName; - - if(p->second.evictor) - { - keyName = evictorKeyName; - valueName = evictorValueName; - } - else - { - keyName = p->second.key; - valueName = p->second.value; - } - - // - // Look up the key and value types in the old and new Slice definitions. - // - Slice::TypePtr oldKeyType = findType(oldUnit, keyName); - if(!oldKeyType) - { - cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first - << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newKeyType = findType(newUnit, keyName); - if(!newKeyType) - { - cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first - << "' not found in new Slice definitions" << endl; - } - Slice::TypePtr oldValueType = findType(oldUnit, valueName); - if(!oldValueType) - { - cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first - << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newValueType = findType(newUnit, valueName); - if(!newValueType) - { - cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first - << "' not found in new Slice definitions" << endl; - } - - // - // If we are generating an output file, we do not consider a missing type to be - // an error. Since the type information comes from the catalog of the old - // environment, it's possible that the key or value types are not present in - // the new Slice definitions. Rather than abort at this point, we simply emit - // a partially-defined <database> element that must be edited by the user. - // - // If we are not generating an output file, we have to stop now. - // - if(outputFile.empty() && (!oldKeyType || !newKeyType || !oldValueType || !newValueType)) - { - return EXIT_FAILURE; - } - - analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType); - } - } - else - { - string oldKeyName, newKeyName, oldValueName, newValueName; - - if(evictor) - { - oldKeyName = newKeyName = evictorKeyName; - oldValueName = newValueName = evictorValueName; - } - else - { - string::size_type pos; - - if(keyTypeNames.empty() || valueTypeNames.empty()) - { - usage(argv[0]); - return EXIT_FAILURE; - } - - pos = keyTypeNames.find(','); - if(pos == 0 || pos == keyTypeNames.size()) - { - usage(argv[0]); - return EXIT_FAILURE; - } - if(pos == string::npos) - { - oldKeyName = keyTypeNames; - newKeyName = keyTypeNames; - } - else - { - oldKeyName = keyTypeNames.substr(0, pos); - newKeyName = keyTypeNames.substr(pos + 1); - } - - pos = valueTypeNames.find(','); - if(pos == 0 || pos == valueTypeNames.size()) - { - usage(argv[0]); - return EXIT_FAILURE; - } - if(pos == string::npos) - { - oldValueName = valueTypeNames; - newValueName = valueTypeNames; - } - else - { - oldValueName = valueTypeNames.substr(0, pos); - newValueName = valueTypeNames.substr(pos + 1); - } - } - - // - // Look up the key and value types in the old and new Slice definitions. - // - Slice::TypePtr oldKeyType = findType(oldUnit, oldKeyName); - if(!oldKeyType) - { - cerr << argv[0] << ": type `" << oldKeyName << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newKeyType = findType(newUnit, newKeyName); - if(!newKeyType) - { - cerr << argv[0] << ": type `" << newKeyName << "' not found in new Slice definitions" << endl; - } - Slice::TypePtr oldValueType = findType(oldUnit, oldValueName); - if(!oldValueType) - { - cerr << argv[0] << ": type `" << oldValueName << "' not found in old Slice definitions" << endl; - } - Slice::TypePtr newValueType = findType(newUnit, newValueName); - if(!newValueType) - { - cerr << argv[0] << ": type `" << newValueName << "' not found in new Slice definitions" << endl; - } - - // - // Stop now if any of the types could not be found. - // - if(!oldKeyType || !newKeyType || !oldValueType || !newValueType) - { - return EXIT_FAILURE; - } - - analyzer.addDatabase("", oldKeyType, newKeyType, oldValueType, newValueType); - } - - analyzer.finish(); + FreezeScript::TransformAnalyzer analyzer(oldUnit, newUnit, ignoreTypeChanges, out, missingTypes, analyzeErrors); + + const string evictorKeyName = "::Ice::Identity"; + const string evictorValueName = "::Freeze::ObjectRecord"; + + if(allDb) + { + // + // Add a <database> element for each database in the catalog. + // + for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) + { + string keyName, valueName; + + if(p->second.evictor) + { + keyName = evictorKeyName; + valueName = evictorValueName; + } + else + { + keyName = p->second.key; + valueName = p->second.value; + } + + // + // Look up the key and value types in the old and new Slice definitions. + // + Slice::TypePtr oldKeyType = findType(oldUnit, keyName); + if(!oldKeyType) + { + cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first + << "' not found in old Slice definitions" << endl; + } + Slice::TypePtr newKeyType = findType(newUnit, keyName); + if(!newKeyType) + { + cerr << argv[0] << ": type `" << keyName << "' from database `" << p->first + << "' not found in new Slice definitions" << endl; + } + Slice::TypePtr oldValueType = findType(oldUnit, valueName); + if(!oldValueType) + { + cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first + << "' not found in old Slice definitions" << endl; + } + Slice::TypePtr newValueType = findType(newUnit, valueName); + if(!newValueType) + { + cerr << argv[0] << ": type `" << valueName << "' from database `" << p->first + << "' not found in new Slice definitions" << endl; + } + + // + // If we are generating an output file, we do not consider a missing type to be + // an error. Since the type information comes from the catalog of the old + // environment, it's possible that the key or value types are not present in + // the new Slice definitions. Rather than abort at this point, we simply emit + // a partially-defined <database> element that must be edited by the user. + // + // If we are not generating an output file, we have to stop now. + // + if(outputFile.empty() && (!oldKeyType || !newKeyType || !oldValueType || !newValueType)) + { + return EXIT_FAILURE; + } + + analyzer.addDatabase(p->first, oldKeyType, newKeyType, oldValueType, newValueType); + } + } + else + { + string oldKeyName, newKeyName, oldValueName, newValueName; + + if(evictor) + { + oldKeyName = newKeyName = evictorKeyName; + oldValueName = newValueName = evictorValueName; + } + else + { + string::size_type pos; + + if(keyTypeNames.empty() || valueTypeNames.empty()) + { + usage(argv[0]); + return EXIT_FAILURE; + } + + pos = keyTypeNames.find(','); + if(pos == 0 || pos == keyTypeNames.size()) + { + usage(argv[0]); + return EXIT_FAILURE; + } + if(pos == string::npos) + { + oldKeyName = keyTypeNames; + newKeyName = keyTypeNames; + } + else + { + oldKeyName = keyTypeNames.substr(0, pos); + newKeyName = keyTypeNames.substr(pos + 1); + } + + pos = valueTypeNames.find(','); + if(pos == 0 || pos == valueTypeNames.size()) + { + usage(argv[0]); + return EXIT_FAILURE; + } + if(pos == string::npos) + { + oldValueName = valueTypeNames; + newValueName = valueTypeNames; + } + else + { + oldValueName = valueTypeNames.substr(0, pos); + newValueName = valueTypeNames.substr(pos + 1); + } + } + + // + // Look up the key and value types in the old and new Slice definitions. + // + Slice::TypePtr oldKeyType = findType(oldUnit, oldKeyName); + if(!oldKeyType) + { + cerr << argv[0] << ": type `" << oldKeyName << "' not found in old Slice definitions" << endl; + } + Slice::TypePtr newKeyType = findType(newUnit, newKeyName); + if(!newKeyType) + { + cerr << argv[0] << ": type `" << newKeyName << "' not found in new Slice definitions" << endl; + } + Slice::TypePtr oldValueType = findType(oldUnit, oldValueName); + if(!oldValueType) + { + cerr << argv[0] << ": type `" << oldValueName << "' not found in old Slice definitions" << endl; + } + Slice::TypePtr newValueType = findType(newUnit, newValueName); + if(!newValueType) + { + cerr << argv[0] << ": type `" << newValueName << "' not found in new Slice definitions" << endl; + } + + // + // Stop now if any of the types could not be found. + // + if(!oldKeyType || !newKeyType || !oldValueType || !newValueType) + { + return EXIT_FAILURE; + } + + analyzer.addDatabase("", oldKeyType, newKeyType, oldValueType, newValueType); + } + + analyzer.finish(); if(!analyzeErrors.empty()) { @@ -717,7 +717,7 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) // Open the old database environment. Use DB_RECOVER_FATAL if -c is specified. // No transaction is created for the old environment. // - // DB_THREAD is for compatibility with Freeze (the catalog) + // DB_THREAD is for compatibility with Freeze (the catalog) { u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_CREATE | DB_THREAD; if(catastrophicRecover) @@ -734,42 +734,42 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) // // Open the new database environment and start a transaction. // - // - // DB_THREAD is for compatibility with Freeze (the catalog) - // + // + // DB_THREAD is for compatibility with Freeze (the catalog) + // { u_int32_t flags = DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_CREATE - | DB_THREAD; + | DB_THREAD; dbEnvNew.open(dbEnvNameNew.c_str(), flags, FREEZE_SCRIPT_DB_MODE); } - // - // TODO: handle properly DbHome config (currently it will break if it's set for the new env) - // - - // - // Open the catalog of the new environment, and start a transaction. - // - Freeze::ConnectionPtr connectionNew = Freeze::createConnection(communicator, dbEnvNameNew, dbEnvNew); - txNew = connectionNew->beginTransaction(); - DbTxn* txnNew = Freeze::getTxn(txNew); - - if(allDb) - { - // - // Transform all databases in the old catalog. - // - for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) - { - transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew, - dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); - } - } - else - { - transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs, - oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); - } + // + // TODO: handle properly DbHome config (currently it will break if it's set for the new env) + // + + // + // Open the catalog of the new environment, and start a transaction. + // + Freeze::ConnectionPtr connectionNew = Freeze::createConnection(communicator, dbEnvNameNew, dbEnvNew); + txNew = connectionNew->beginTransaction(); + DbTxn* txnNew = Freeze::getTxn(txNew); + + if(allDb) + { + // + // Transform all databases in the old catalog. + // + for(FreezeScript::CatalogDataMap::iterator p = catalog.begin(); p != catalog.end(); ++p) + { + transformDb(p->second.evictor, communicator, objectFactory, dbEnv, dbEnvNew, p->first, connectionNew, + dbs, oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); + } + } + else + { + transformDb(evictor, communicator, objectFactory, dbEnv, dbEnvNew, dbName, connectionNew, dbs, + oldUnit, newUnit, txnNew, purgeObjects, suppress, descriptors); + } } catch(const DbException& ex) { |