56 addConnectOption(
"destConnect",
"d",
"destionation connection string(required)");
57 addOption<std::string>(
"sourceTag",
"i",
"tag to export( default = destination tag)");
58 addOption<std::string>(
"destTag",
"t",
"destination tag (required)");
60 addOption<bool>(
"verbose",
"v",
"verbose");
70 initializePluginManager();
72 std::string sourceConnect = getOptionValue<std::string>(
"sourceConnect");
73 std::string destConnect = getOptionValue<std::string>(
"destConnect");
75 std::string destTag = getOptionValue<std::string>(
"destTag");
77 if (hasOptionValue(
"sourceTag"))
78 sourceTag = getOptionValue<std::string>(
"sourceTag");
79 bool verbose = hasOptionValue(
"verbose");
94 sourceiovtoken = sourceMetadata.
getToken(sourceTag);
95 if (sourceiovtoken.empty())
99 std::cout <<
"source iov token: " << sourceiovtoken << std::endl;
104 std::cout <<
"source iov type " << sourceiovtype << std::endl;
111 ioviterator != iov.
end();
114 std::stringstream newTag;
115 newTag << destTag <<
"_" <<
counter;
118 << ioviterator->since() <<
" \t "
119 << ioviterator->till() << std::endl;
122 std::cout <<
"\t" << ioviterator->token() << std::endl;
125 transaction.
start(
false);
128 if (payloadContainerName==
"Alignments")
129 objToken = processPayloadContainer<Alignments>(sourcedb, destdb,
130 ioviterator->token(), payloadContainerName);
131 else if (payloadContainerName==
"AlignmentErrors")
132 objToken = processPayloadContainer<AlignmentErrors>(sourcedb, destdb,
133 ioviterator->token(), payloadContainerName);
134 else if (payloadContainerName==
"AlignmentSurfaceDeformations")
135 objToken = processPayloadContainer<AlignmentSurfaceDeformations>(sourcedb, destdb,
136 ioviterator->token(), payloadContainerName);
137 else if (payloadContainerName==
"SiPixelLorentzAngle")
138 objToken = processPayloadContainer<SiPixelLorentzAngle>(sourcedb, destdb,
139 ioviterator->token(), payloadContainerName);
140 else if (payloadContainerName==
"SiStripLorentzAngle")
141 objToken = processPayloadContainer<SiStripLorentzAngle>(sourcedb, destdb,
142 ioviterator->token(), payloadContainerName);
143 else if (payloadContainerName==
"SiStripBackPlaneCorrection")
144 objToken = processPayloadContainer<SiStripBackPlaneCorrection>(sourcedb, destdb,
145 ioviterator->token(), payloadContainerName);
157 metadata.
addMapping(newTag.str(), iovToken, sourceiovtype);
165 std::cout <<
"Total # of payload objects: " << counter << std::endl;
178 return destdb.
storeObject(
object.
get(), containerName);
184 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()
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
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)
static std::atomic< unsigned int > counter
TimeType timetype() const
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