13 std::pair<int,int>
ret(-1,-1);
17 coral::ITable& mytable=
s.
nominalSchema().tableHandle(
"TEST_METADATA");
18 std::auto_ptr< coral::IQuery >
query(mytable.newQuery());
19 coral::AttributeList BindVariableList;
21 BindVariableList.extend(
"NAME",
typeid(
std::string));
22 BindVariableList[
"NAME"].data<
std::string>()=mappingName;
23 query->setCondition( condition, BindVariableList );
24 query->addToOutputList(
"SEED" );
25 query->addToOutputList(
"RUN" );
26 coral::ICursor& cursor =
query->execute();
27 while( cursor.next() ) {
28 const coral::AttributeList& row = cursor.currentRow();
29 ret.first = row[
"SEED" ].data<
int>();
30 ret.second =row[
"RUN" ].data<
int>();
36 return std::pair<int,int>(-1,-1);
50 coral::ITable& mytable=
s.
nominalSchema().tableHandle(
"TEST_METADATA");
51 std::auto_ptr< coral::IQuery >
query(mytable.newQuery());
52 coral::AttributeList BindVariableList;
54 BindVariableList.extend(
"NAME",
typeid(
std::string));
55 BindVariableList[
"NAME"].data<
std::string>()=mappingName;
56 query->setCondition( condition, BindVariableList );
57 query->addToOutputList(
"SEED" );
58 coral::ICursor& cursor =
query->execute();
59 while( cursor.next() ) {
60 const coral::AttributeList& row = cursor.currentRow();
61 refSeed=row[
"SEED" ].data<
int>();
65 std::cout <<
"Object with id="<<readToken<<
" has been read"<<std::endl;
71 std::cout <<
" read failed : seed "<<refSeed<<std::endl;
94 if( iPayload == iov.
end() ){
95 std::cout <<
"ERROR: no payload found in IOV for run="<<validity<<std::endl;
99 std::cout <<
"Object with id="<<iPayload->token()<<
" has been read"<<std::endl;
105 std::cout <<
" read failed : seed="<<seed<<std::endl;
120 std::vector<std::string> tokenList;
125 for(
unsigned int i=0;
i<tokenList.size();
i++)
127 if(!
Read(tokenList[
i])) ret =
false;
146 coral::ITable& mytable=
s.
nominalSchema().tableHandle(
"TEST_METADATA");
147 coral::AttributeList rowBuffer;
148 coral::ITableDataEditor& dataEditor = mytable.dataEditor();
149 dataEditor.rowBuffer( rowBuffer );
151 rowBuffer[
"SEED"].data<
int>()=payloadID;
152 rowBuffer[
"RUN"].data<
int>()=-1;
153 dataEditor.insertRow( rowBuffer );
155 boost::shared_ptr<Payload> myRef0(
new Payload(payloadID));
158 std::cout <<
"Stored object with id = "<<tok0<<std::endl;
171 bool updateTestMetadata ){
178 if( updateTestMetadata ){
179 coral::ITable& mytable=
s.
nominalSchema().tableHandle(
"TEST_METADATA");
180 coral::AttributeList rowBuffer;
181 coral::ITableDataEditor& dataEditor = mytable.dataEditor();
182 dataEditor.rowBuffer( rowBuffer );
184 rowBuffer[
"SEED"].data<
int>()=payloadID;
185 rowBuffer[
"RUN"].data<
int>()= runValidity;
186 dataEditor.insertRow( rowBuffer );
189 boost::shared_ptr<Payload> myRef0(
new Payload(payloadID));
192 iov.
append( runValidity, payloadTok );
212 description.setName(
"TEST_METADATA");
213 description.insertColumn(
"NAME", coral::AttributeSpecification::typeNameForId(
typeid(
std::string)) );
214 description.insertColumn(
"SEED", coral::AttributeSpecification::typeNameForId(
typeid(
int)) );
215 description.insertColumn(
"RUN", coral::AttributeSpecification::typeNameForId(
typeid(
int)) );
216 std::vector<std::string> cols;
217 cols.push_back(
"NAME" );
218 description.setPrimaryKey(cols);
219 description.setNotNullConstraint(
"SEED");
220 description.setNotNullConstraint(
"RUN");
221 coral::ITable&
table=schema.createTable(description);
222 table.privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select);
225 }
catch(
const coral::TableAlreadyExistingException& er ){
226 std::cout<<
"table alreay existing, not creating a new one"<<std::endl;
233 std::set<std::string> exclude;
234 exclude.insert(
"VERSION_TABLE");
235 exclude.insert(
"TEST_STATUS");
236 exclude.insert(
"SEQUENCES");
237 exclude.insert(
"TEST_RESULTS");
238 exclude.insert(
"RUN_HEADER");
239 exclude.insert(
"RUN_RESULT");
240 exclude.insert(
"RUN_STEP_RESULT");
247 std::cout <<
" ERROR: "<<exc.what()<<std::endl;
virtual char const * what() const
std::string create(cond::TimeType timetype)
bool ReadWithIOV(std::string mappingName, int seed, int runValidity)
bool deleteObject(const std::string &objectId)
bool WriteWithIOV(std::string mappingName, int payloadID, int runValidity, bool updateTestMetadata)
std::string const & token() const
RegressionTestPayload Payload
const_iterator end() const
bool Write(std::string mappingName, int payloadID)
const_iterator find(cond::Time_t time) const
std::pair< int, int > GetMetadata(std::string mappingName)
int start(bool readOnly=false)
start transaction
std::string storeObject(const T *object, const std::string &containerName)
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
bool Read(std::string mappingName)
coral::ISchema & nominalSchema()
void cleanUp(const std::string &connectionString, std::set< std::string > exclusionList=std::set< std::string >())
bool DropTables(std::string connStr)
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
bool DropItem(std::string mappingName)