44 const std::string &token,
45 const std::string &containerName);
53 addConnectOption(
"destConnect",
"d",
"destionation connection string(required)");
54 addOption<std::string>(
"sourceTag",
"i",
"tag to export( default = destination tag)");
55 addOption<std::string>(
"destTag",
"t",
"destination tag (required)");
57 addOption<bool>(
"verbose",
"v",
"verbose");
67 initializePluginManager();
69 std::string sourceConnect = getOptionValue<std::string>(
"sourceConnect");
70 std::string destConnect = getOptionValue<std::string>(
"destConnect");
72 std::string destTag = getOptionValue<std::string>(
"destTag");
73 std::string sourceTag(destTag);
74 if (hasOptionValue(
"sourceTag"))
75 sourceTag = getOptionValue<std::string>(
"sourceTag");
76 bool verbose = hasOptionValue(
"verbose");
81 std::string sourceiovtoken;
84 std::string destiovtoken;
91 sourceiovtoken = sourceMetadata.
getToken(sourceTag);
92 if (sourceiovtoken.empty())
93 throw std::runtime_error(std::string(
"tag ") + sourceTag + std::string(
" not found"));
96 std::cout <<
"source iov token: " << sourceiovtoken << std::endl;
101 std::cout <<
"source iov type " << sourceiovtype << std::endl;
106 unsigned int counter = 0;
108 ioviterator != iov.
end();
111 std::stringstream newTag;
112 newTag << destTag <<
"_" << counter;
115 << ioviterator->since() <<
" \t "
116 << ioviterator->till() << std::endl;
119 std::cout <<
"\t" << ioviterator->token() << std::endl;
122 transaction.
start(
false);
123 std::string payloadContainerName = sourcedb.
classNameForItem(ioviterator->token());
124 std::string objToken;
125 if (payloadContainerName==
"Alignments")
126 objToken = processPayloadContainer<Alignments>(sourcedb, destdb,
127 ioviterator->token(), payloadContainerName);
128 else if (payloadContainerName==
"AlignmentErrors")
129 objToken = processPayloadContainer<AlignmentErrors>(sourcedb, destdb,
130 ioviterator->token(), payloadContainerName);
131 else if (payloadContainerName==
"AlignmentSurfaceDeformations")
132 objToken = processPayloadContainer<AlignmentSurfaceDeformations>(sourcedb, destdb,
133 ioviterator->token(), payloadContainerName);
141 std::string iovToken = editor.
token();
145 metadata.
addMapping(newTag.str(), iovToken, sourceiovtype);
153 std::cout <<
"Total # of payload objects: " << counter << std::endl;
161 const std::string &token,
162 const std::string &containerName)
166 return destdb.
storeObject(
object.
get(), containerName);
172 return utilities.
run(argc,argv);
const TimeTypeSpecs timeTypeSpecs[]
std::string create(cond::TimeType timetype)
int run(int argc, char **argv)
std::string classNameForItem(const std::string &objectId)
DbTransaction & transaction()
TimeType timetype() const
std::string const & token() const
const_iterator begin() const
const_iterator end() const
int main(int argc, char **argv)
int start(bool readOnly=false)
start transaction
unsigned long long Time_t
const T & max(const T &a, const T &b)
void addAuthenticationOptions()
int start(bool readOnly=false)
start transaction
std::string storeObject(const T *object, const std::string &containerName)
std::string processPayloadContainer(cond::DbSession &sourcedb, cond::DbSession &destdb, const std::string &token, const std::string &containerName)
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
void stamp(std::string const &icomment, bool append=false)
boost::shared_ptr< T > getTypedObject(const std::string &objectId)
int commit()
commit transaction. Will disconnect from database if connection timeout==0 or connectted time close t...
iov_range_iterator const_iterator