CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::Logger Class Reference

#include <Logger.h>

Public Member Functions

void createLogDBIfNonExist ()
 
bool getWriteLock () throw ()
 
void logFailedOperationNow (const cond::UserLogInfo &userlogInfo, const std::string &destDB, const std::string &payloadToken, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince, const std::string &exceptionMessage)
 
 Logger (DbSession &sessionHandle)
 
void logOperationNow (const cond::UserLogInfo &userlogInfo, const std::string &destDB, const std::string &payloadToken, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince)
 
void LookupLastEntryByProvenance (const std::string &provenance, LogDBEntry &logentry, bool filterFailedOp=true) const
 
void LookupLastEntryByTag (const std::string &iovtag, LogDBEntry &logentry, bool filterFailedOp=true) const
 
void LookupLastEntryByTag (const std::string &iovtag, const std::string &connectionStr, LogDBEntry &logentry, bool filterFailedOp=true) const
 
bool releaseWriteLock () throw ()
 
 ~Logger ()
 

Private Member Functions

void insertLogRecord (unsigned long long logId, const std::string &utctime, const std::string &destDB, const std::string &payloadToken, const cond::UserLogInfo &userLogInfo, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince, const std::string &exceptionMessage)
 

Private Attributes

bool m_locked
 
bool m_logTableExists
 
SequenceManagerm_sequenceManager
 
DbSession m_sessionHandle
 
coral::IQuery * m_statusEditorHandle
 

Detailed Description

Definition at line 25 of file Logger.h.

Constructor & Destructor Documentation

cond::Logger::Logger ( cond::DbSession sessionHandle)
explicit

Definition at line 31 of file Logger.cc.

32 }
SequenceManager * m_sequenceManager
Definition: Logger.h:104
bool m_locked
Definition: Logger.h:102
DbSession m_sessionHandle
Definition: Logger.h:100
coral::IQuery * m_statusEditorHandle
Definition: Logger.h:103
bool m_logTableExists
Definition: Logger.h:105
cond::Logger::~Logger ( )

Definition at line 377 of file Logger.cc.

377  {
378  if( m_sequenceManager ){
379  delete m_sequenceManager;
381  }
382 }
SequenceManager * m_sequenceManager
Definition: Logger.h:104

Member Function Documentation

void cond::Logger::createLogDBIfNonExist ( )

Definition at line 61 of file Logger.cc.

References cond::SequenceManager::createSequencesTable(), idDealer::description, cond::SequenceManager::existSequencesTable(), cond::LogDBNames::LogTableName(), and cond::LogDBNames::SequenceTableName().

61  {
62  if(m_logTableExists) return;
66  m_logTableExists=true;
68  return;
69  }
70  //create sequence table
72  if( !sequenceGenerator.existSequencesTable() ){
73  sequenceGenerator.createSequencesTable();
74  }
75  //create log table
76  coral::TableDescription description( "CONDLOG" );
78  description.insertColumn(std::string("LOGID"),
79  coral::AttributeSpecification::typeNameForType<unsigned long long>() );
80  description.setPrimaryKey( std::vector<std::string>( 1, std::string("LOGID")));
81  description.insertColumn(std::string("EXECTIME"),
82  coral::AttributeSpecification::typeNameForType<std::string>() );
83  description.setNotNullConstraint(std::string("EXECTIME"));
84 
85  description.insertColumn(std::string("IOVTAG"),
86  coral::AttributeSpecification::typeNameForType<std::string>() );
87  description.setNotNullConstraint(std::string("IOVTAG"));
88 
89  description.insertColumn(std::string("IOVTIMETYPE"),
90  coral::AttributeSpecification::typeNameForType<std::string>() );
91  description.setNotNullConstraint(std::string("IOVTIMETYPE"));
92 
93  description.insertColumn(std::string("PAYLOADCONTAINER"),
94  coral::AttributeSpecification::typeNameForType<std::string>() );
95  description.setNotNullConstraint(std::string("PAYLOADCONTAINER"));
96 
97  description.insertColumn(std::string("PAYLOADNAME"),
98  coral::AttributeSpecification::typeNameForType<std::string>() );
99  description.setNotNullConstraint(std::string("PAYLOADNAME"));
100 
101  description.insertColumn(std::string("PAYLOADTOKEN"),
102  coral::AttributeSpecification::typeNameForType<std::string>() );
103  description.setNotNullConstraint(std::string("PAYLOADTOKEN"));
104 
105  description.insertColumn(std::string("PAYLOADINDEX"),
106  coral::AttributeSpecification::typeNameForType<unsigned int>() );
107  description.setNotNullConstraint(std::string("PAYLOADINDEX"));
108 
109  description.insertColumn(std::string("LASTSINCE"),
110  coral::AttributeSpecification::typeNameForType<unsigned long long>() );
111  description.setNotNullConstraint(std::string("LASTSINCE"));
112 
113  description.insertColumn(std::string("DESTINATIONDB"),
114  coral::AttributeSpecification::typeNameForType<std::string>() );
115  description.setNotNullConstraint(std::string("DESTINATIONDB"));
116 
117  description.insertColumn(std::string("PROVENANCE"),
118  coral::AttributeSpecification::typeNameForType<std::string>() );
119  description.insertColumn(std::string("USERTEXT"),
120  coral::AttributeSpecification::typeNameForType<std::string>() );
121  description.insertColumn(std::string("EXECMESSAGE"),
122  coral::AttributeSpecification::typeNameForType<std::string>() );
123  m_sessionHandle.nominalSchema().createTable( description ).privilegeManager().grantToPublic( coral::ITablePrivilegeManager::Select );
124  m_logTableExists=true;
126 }
DbTransaction & transaction()
Definition: DbSession.cc:153
int commit()
commit transaction.
DbSession m_sessionHandle
Definition: Logger.h:100
int start(bool readOnly=false)
start transaction
tuple description
Definition: idDealer.py:66
static std::string SequenceTableName()
Definition: LogDBNames.cc:3
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175
bool m_logTableExists
Definition: Logger.h:105
static std::string LogTableName()
Definition: LogDBNames.cc:7
bool cond::Logger::getWriteLock ( )
throw (
)

Definition at line 34 of file Logger.cc.

References cmsCodeRules.cppFunctionSkipper::exception, and cond::LogDBNames::LogTableName().

34  {
35  try{
37  coral::ITable& statusTable=m_sessionHandle.nominalSchema().tableHandle(LogDBNames::LogTableName());
38  //Instructs the server to lock the rows involved in the result set.
39  m_statusEditorHandle=statusTable.newQuery();
40  m_statusEditorHandle->setForUpdate();
41  m_statusEditorHandle->execute();
42  }catch(const std::exception& er){
43  delete m_statusEditorHandle;
45  return false;
46  }
47  m_locked=true;
48  return true;
49 }
bool m_locked
Definition: Logger.h:102
DbTransaction & transaction()
Definition: DbSession.cc:153
DbSession m_sessionHandle
Definition: Logger.h:100
int start(bool readOnly=false)
start transaction
coral::IQuery * m_statusEditorHandle
Definition: Logger.h:103
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175
static std::string LogTableName()
Definition: LogDBNames.cc:7
void cond::Logger::insertLogRecord ( unsigned long long  logId,
const std::string &  utctime,
const std::string &  destDB,
const std::string &  payloadToken,
const cond::UserLogInfo userLogInfo,
const std::string &  iovtag,
const std::string &  iovtimetype,
unsigned int  payloadIdx,
unsigned long long  lastSince,
const std::string &  exceptionMessage 
)
private

Definition at line 331 of file Logger.cc.

References cmsCodeRules.cppFunctionSkipper::exception, edm::hlt::Exception, cond::LogDBNames::LogTableName(), cond::parseToken(), cond::UserLogInfo::provenance, and cond::UserLogInfo::usertext.

340  {
341  try{
342  std::string containerName=parseToken(payloadToken).first;
343  std::string payloadName=containerName; //now container and real class are assumed equal
344  coral::AttributeList rowData;
345  rowData.extend<unsigned long long>("LOGID");
346  rowData.extend<std::string>("EXECTIME");
347  rowData.extend<std::string>("PAYLOADCONTAINER");
348  rowData.extend<std::string>("DESTINATIONDB");
349  rowData.extend<std::string>("PAYLOADNAME");
350  rowData.extend<std::string>("PAYLOADTOKEN");
351  rowData.extend<std::string>("PROVENANCE");
352  rowData.extend<std::string>("USERTEXT");
353  rowData.extend<std::string>("IOVTAG");
354  rowData.extend<std::string>("IOVTIMETYPE");
355  rowData.extend<unsigned int>("PAYLOADINDEX");
356  rowData.extend<unsigned long long>("LASTSINCE");
357  rowData.extend<std::string>("EXECMESSAGE");
358  rowData["LOGID"].data< unsigned long long >() = logId;
359  rowData["EXECTIME"].data< std::string >() = utctime;
360  rowData["PAYLOADCONTAINER"].data< std::string >() = containerName;
361  rowData["DESTINATIONDB"].data< std::string >() = destDB;
362  rowData["PAYLOADNAME"].data< std::string >() = payloadName;
363  rowData["PAYLOADTOKEN"].data< std::string >() = payloadToken;
364  rowData["PROVENANCE"].data< std::string >() = userLogInfo.provenance;
365  rowData["USERTEXT"].data< std::string >() = userLogInfo.usertext;
366  rowData["IOVTAG"].data< std::string >() = iovtag;
367  rowData["IOVTIMETYPE"].data< std::string >() = iovtimetype;
368  rowData["PAYLOADINDEX"].data< unsigned int >() = payloadIdx;
369  rowData["LASTSINCE"].data< unsigned long long >() = lastSince;
370  rowData["EXECMESSAGE"].data< std::string >() = exceptionMessage;
371  m_sessionHandle.nominalSchema().tableHandle(cond::LogDBNames::LogTableName()).dataEditor().insertRow(rowData);
372  }catch(const std::exception& er){
373  throw cond::Exception(std::string(er.what()));
374  }
375 }
std::string usertext
Definition: UserLogInfo.h:8
std::pair< std::string, int > parseToken(const std::string &objectId)
Definition: PoolToken.cc:16
DbSession m_sessionHandle
Definition: Logger.h:100
std::string provenance
Definition: UserLogInfo.h:7
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175
static std::string LogTableName()
Definition: LogDBNames.cc:7
void cond::Logger::logFailedOperationNow ( const cond::UserLogInfo userlogInfo,
const std::string &  destDB,
const std::string &  payloadToken,
const std::string &  iovtag,
const std::string &  iovtimetype,
unsigned int  payloadIdx,
unsigned long long  lastSince,
const std::string &  exceptionMessage 
)

Definition at line 150 of file Logger.cc.

References cond::LogDBNames::LogTableName(), cmsPerfSuiteHarvest::now, L1TEmulatorMonitor_cff::p, cond::LogDBNames::SequenceTableName(), and cond::to_string().

159  {
160  //aquirelocaltime
161  boost::posix_time::ptime p=boost::posix_time::microsec_clock::local_time();
162  std::string now=cond::to_string(p.date().year())+"-"+cond::to_string(p.date().month())+"-"+cond::to_string(p.date().day())+"-"+cond::to_string(p.time_of_day().hours())+":"+cond::to_string(p.time_of_day().minutes())+":"+cond::to_string(p.time_of_day().seconds());
163  //aquireentryid
164  if(!m_sequenceManager){
166  }
167  unsigned long long targetLogId=m_sequenceManager->incrementId(LogDBNames::LogTableName());
168  //insert log record with the new id
169  this->insertLogRecord(targetLogId,now,destDB,payloadToken,userlogInfo,iovtag,iovtimetype,payloadIdx,lastSince,exceptionMessage);
170 }
SequenceManager * m_sequenceManager
Definition: Logger.h:104
DbSession m_sessionHandle
Definition: Logger.h:100
std::string to_string(const T &t)
Definition: Logger.cc:25
static std::string SequenceTableName()
Definition: LogDBNames.cc:3
void insertLogRecord(unsigned long long logId, const std::string &utctime, const std::string &destDB, const std::string &payloadToken, const cond::UserLogInfo &userLogInfo, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince, const std::string &exceptionMessage)
Definition: Logger.cc:331
unsigned long long incrementId(const std::string &reftableName)
Increments and returns a new valid oid for a table.
static std::string LogTableName()
Definition: LogDBNames.cc:7
void cond::Logger::logOperationNow ( const cond::UserLogInfo userlogInfo,
const std::string &  destDB,
const std::string &  payloadToken,
const std::string &  iovtag,
const std::string &  iovtimetype,
unsigned int  payloadIdx,
unsigned long long  lastSince 
)

Definition at line 128 of file Logger.cc.

References cond::LogDBNames::LogTableName(), cmsPerfSuiteHarvest::now, L1TEmulatorMonitor_cff::p, cond::LogDBNames::SequenceTableName(), and cond::to_string().

136  {
137  //aquireutctime
138  //using namespace boost::posix_time;
139  boost::posix_time::ptime p=boost::posix_time::microsec_clock::universal_time();
140  std::string now=cond::to_string(p.date().year())+"-"+cond::to_string(p.date().month())+"-"+cond::to_string(p.date().day())+"-"+cond::to_string(p.time_of_day().hours())+":"+cond::to_string(p.time_of_day().minutes())+":"+cond::to_string(p.time_of_day().seconds());
141  //aquireentryid
142  if(!m_sequenceManager){
144  }
145  unsigned long long targetLogId=m_sequenceManager->incrementId(LogDBNames::LogTableName());
146  //insert log record with the new id
147  this->insertLogRecord(targetLogId,now,destDB,payloadToken,userlogInfo,iovtag,iovtimetype,payloadIdx,lastSince,"OK");
148 }
SequenceManager * m_sequenceManager
Definition: Logger.h:104
DbSession m_sessionHandle
Definition: Logger.h:100
std::string to_string(const T &t)
Definition: Logger.cc:25
static std::string SequenceTableName()
Definition: LogDBNames.cc:3
void insertLogRecord(unsigned long long logId, const std::string &utctime, const std::string &destDB, const std::string &payloadToken, const cond::UserLogInfo &userLogInfo, const std::string &iovtag, const std::string &iovtimetype, unsigned int payloadIdx, unsigned long long lastSince, const std::string &exceptionMessage)
Definition: Logger.cc:331
unsigned long long incrementId(const std::string &reftableName)
Increments and returns a new valid oid for a table.
static std::string LogTableName()
Definition: LogDBNames.cc:7
void cond::Logger::LookupLastEntryByProvenance ( const std::string &  provenance,
LogDBEntry logentry,
bool  filterFailedOp = true 
) const

Definition at line 173 of file Logger.cc.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, cond::LogDBEntry::lastSince, cond::LogDBEntry::logId, cond::LogDBNames::LogTableName(), cond::LogDBEntry::payloadContainer, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadName, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, o2o::query, and cond::LogDBEntry::usertext.

175  {
176  //select max(logid),etc from logtable where etc"
177  //construct where
178  std::string whereClause=cond::LogDBNames::LogTableName();
179  whereClause+=".PROVENANCE=:provenance";
180  if(filterFailedOp){
181  whereClause+=std::string(" AND ");
182  whereClause+=cond::LogDBNames::LogTableName();
183  whereClause+=std::string(".EXECMESSAGE=:execmessage");
184  }
185  coral::AttributeList BindVariableList;
186  BindVariableList.extend("provenance",typeid(std::string) );
187  BindVariableList.extend("execmessage",typeid(std::string) );
188  BindVariableList["provenance"].data<std::string>()=provenance;
189  BindVariableList["execmessage"].data<std::string>()="OK";
191  {
192  std::auto_ptr<coral::IQuery> query(m_sessionHandle.nominalSchema().newQuery());
193  // construct select
194  query->addToOutputList( cond::LogDBNames::LogTableName()+".LOGID" );
195  query->defineOutputType( cond::LogDBNames::LogTableName()+".LOGID", "unsigned long long" );
196  query->addToOutputList( cond::LogDBNames::LogTableName()+".DESTINATIONDB" );
197  query->addToOutputList( cond::LogDBNames::LogTableName()+".PROVENANCE" );
198  query->addToOutputList( cond::LogDBNames::LogTableName()+".USERTEXT" );
199  query->addToOutputList( cond::LogDBNames::LogTableName()+".IOVTAG" );
200  query->addToOutputList( cond::LogDBNames::LogTableName()+".IOVTIMETYPE" );
201  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADINDEX" );
202  query->defineOutputType( cond::LogDBNames::LogTableName()+".PAYLOADINDEX", "unsigned int" );
203  query->addToOutputList( cond::LogDBNames::LogTableName()+".LASTSINCE" );
204  query->defineOutputType( cond::LogDBNames::LogTableName()+".LASTSINCE", "unsigned long long" );
205  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADNAME" );
206  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADTOKEN" );
207  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADCONTAINER" );
208  query->addToOutputList( cond::LogDBNames::LogTableName()+".EXECTIME" );
209  query->addToOutputList( cond::LogDBNames::LogTableName()+".EXECMESSAGE" );
210 
211  coral::IQueryDefinition& subquery=query->defineSubQuery("subQ");
212  query->addToTableList("subQ");
213  query->addToTableList(cond::LogDBNames::LogTableName());
214  subquery.addToTableList( cond::LogDBNames::LogTableName() );
215  subquery.addToOutputList( "max(LOGID)", "max_logid");
216  subquery.setCondition( whereClause, BindVariableList );
217  query->setCondition(cond::LogDBNames::LogTableName()+std::string(".LOGID=subQ.max_logid"),coral::AttributeList() );
218  query->defineOutputType( "subQ.max_logid", "unsigned long long" );
219 
220  coral::ICursor& cursor = query->execute();
221  if( cursor.next() ) {
222  const coral::AttributeList& row = cursor.currentRow();
223  logentry.logId=row[cond::LogDBNames::LogTableName()+".LOGID"].data<unsigned long long>();
224  logentry.destinationDB=row[cond::LogDBNames::LogTableName()+".DESTINATIONDB"].data<std::string>();
225  logentry.provenance=row[cond::LogDBNames::LogTableName()+".PROVENANCE"].data<std::string>();
226  logentry.usertext=row[cond::LogDBNames::LogTableName()+".USERTEXT"].data<std::string>();
227  logentry.iovtag=row[cond::LogDBNames::LogTableName()+".IOVTAG"].data<std::string>();
228  logentry.iovtimetype=row[cond::LogDBNames::LogTableName()+".IOVTIMETYPE"].data<std::string>();
229  logentry.payloadIdx=row[cond::LogDBNames::LogTableName()+".PAYLOADINDEX"].data<unsigned int>();
230  logentry.lastSince=row[cond::LogDBNames::LogTableName()+".LASTSINCE"].data<unsigned long long>();
231  logentry.payloadName=row[cond::LogDBNames::LogTableName()+".PAYLOADNAME"].data<std::string>();
232  logentry.payloadToken=row[cond::LogDBNames::LogTableName()+".PAYLOADTOKEN"].data<std::string>();
233  logentry.payloadContainer=row[cond::LogDBNames::LogTableName()+".PAYLOADCONTAINER"].data<std::string>();
234  logentry.exectime=row[cond::LogDBNames::LogTableName()+".EXECTIME"].data<std::string>();
235  logentry.execmessage=row[cond::LogDBNames::LogTableName()+".EXECMESSAGE"].data<std::string>();
236 
237  //row.toOutputStream( std::cout ) << std::endl;
238  }
239  }
241 }
DbTransaction & transaction()
Definition: DbSession.cc:153
int commit()
commit transaction.
DbSession m_sessionHandle
Definition: Logger.h:100
int start(bool readOnly=false)
start transaction
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175
tuple query
Definition: o2o.py:269
static std::string LogTableName()
Definition: LogDBNames.cc:7
void cond::Logger::LookupLastEntryByTag ( const std::string &  iovtag,
LogDBEntry logentry,
bool  filterFailedOp = true 
) const

Definition at line 325 of file Logger.cc.

Referenced by popcon::PopCon::initialize().

327  {
328  LookupLastEntryByTag(iovtag,"",logentry,filterFailedOp);
329 }
void LookupLastEntryByTag(const std::string &iovtag, LogDBEntry &logentry, bool filterFailedOp=true) const
Definition: Logger.cc:325
void cond::Logger::LookupLastEntryByTag ( const std::string &  iovtag,
const std::string &  connectionStr,
cond::LogDBEntry logentry,
bool  filterFailedOp = true 
) const

select * from "COND_LOG_TABLE" where "LOGID"=(select max("LOGID") AS "max_logid" from "COND_LOG_TABLE" where "IOVTAG"='mytag1' and "EXECMESSAGE"='OK');

Definition at line 243 of file Logger.cc.

References cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, cond::LogDBEntry::lastSince, cond::LogDBEntry::logId, cond::LogDBNames::LogTableName(), cond::LogDBEntry::payloadContainer, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadName, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, o2o::query, and cond::LogDBEntry::usertext.

246  {
251  std::string whereClause=cond::LogDBNames::LogTableName();
252  whereClause+=std::string(".IOVTAG=:iovtag");
253  coral::AttributeList BindVariableList;
254  BindVariableList.extend("iovtag",typeid(std::string) );
255  BindVariableList["iovtag"].data<std::string>()=iovtag;
256  if(connectionStr!=""){
257  whereClause+=std::string(" AND ");
258  whereClause+=cond::LogDBNames::LogTableName();
259  whereClause+=std::string(".DESTINATIONDB=:destinationdb");
260  BindVariableList.extend("destinationdb",typeid(std::string) );
261  BindVariableList["destinationdb"].data<std::string>()=connectionStr;
262  }
263  if(filterFailedOp){
264  whereClause+=std::string(" AND ");
265  whereClause+=cond::LogDBNames::LogTableName();
266  whereClause+=std::string(".EXECMESSAGE=:execmessage");
267  BindVariableList.extend("execmessage",typeid(std::string) );
268  BindVariableList["execmessage"].data<std::string>()="OK";
269  }
270 
272  //coral::IQuery* query = m_coraldb.nominalSchema().tableHandle(cond::LogDBNames::LogTableName()).newQuery();
273  {
274  std::auto_ptr<coral::IQuery> query(m_sessionHandle.nominalSchema().newQuery());
275  // construct select
276  query->addToOutputList( cond::LogDBNames::LogTableName()+".LOGID" );
277  query->defineOutputType( cond::LogDBNames::LogTableName()+".LOGID", "unsigned long long" );
278  query->addToOutputList( cond::LogDBNames::LogTableName()+".DESTINATIONDB" );
279  query->addToOutputList( cond::LogDBNames::LogTableName()+".PROVENANCE" );
280  query->addToOutputList( cond::LogDBNames::LogTableName()+".USERTEXT" );
281  query->addToOutputList( cond::LogDBNames::LogTableName()+".IOVTAG" );
282  query->addToOutputList( cond::LogDBNames::LogTableName()+".IOVTIMETYPE" );
283  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADINDEX" );
284  query->defineOutputType( cond::LogDBNames::LogTableName()+".PAYLOADINDEX", "unsigned int" );
285  query->addToOutputList( cond::LogDBNames::LogTableName()+".LASTSINCE" );
286  query->defineOutputType( cond::LogDBNames::LogTableName()+".LASTSINCE", "unsigned long long" );
287  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADNAME" );
288  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADTOKEN" );
289  query->addToOutputList( cond::LogDBNames::LogTableName()+".PAYLOADCONTAINER" );
290  query->addToOutputList( cond::LogDBNames::LogTableName()+".EXECTIME" );
291  query->addToOutputList( cond::LogDBNames::LogTableName()+".EXECMESSAGE" );
292 
293  coral::IQueryDefinition& subquery=query->defineSubQuery("subQ");
294  query->addToTableList("subQ");
295  query->addToTableList(cond::LogDBNames::LogTableName());
296  subquery.addToTableList( cond::LogDBNames::LogTableName() );
297  subquery.addToOutputList( "max(LOGID)", "max_logid");
298  subquery.setCondition( whereClause, BindVariableList );
299  query->setCondition(cond::LogDBNames::LogTableName()+std::string(".LOGID=subQ.max_logid"),coral::AttributeList() );
300  query->defineOutputType( "subQ.max_logid", "unsigned long long" );
301 
302  coral::ICursor& cursor = query->execute();
303  if( cursor.next() ) {
304  const coral::AttributeList& row = cursor.currentRow();
305  logentry.logId=row[cond::LogDBNames::LogTableName()+".LOGID"].data<unsigned long long>();
306  logentry.destinationDB=row[cond::LogDBNames::LogTableName()+".DESTINATIONDB"].data<std::string>();
307  logentry.provenance=row[cond::LogDBNames::LogTableName()+".PROVENANCE"].data<std::string>();
308  logentry.usertext=row[cond::LogDBNames::LogTableName()+".USERTEXT"].data<std::string>();
309  logentry.iovtag=row[cond::LogDBNames::LogTableName()+".IOVTAG"].data<std::string>();
310  logentry.iovtimetype=row[cond::LogDBNames::LogTableName()+".IOVTIMETYPE"].data<std::string>();
311  logentry.payloadIdx=row[cond::LogDBNames::LogTableName()+".PAYLOADINDEX"].data<unsigned int>();
312  logentry.lastSince=row[cond::LogDBNames::LogTableName()+".LASTSINCE"].data<unsigned long long>();
313  logentry.payloadName=row[cond::LogDBNames::LogTableName()+".PAYLOADNAME"].data<std::string>();
314  logentry.payloadToken=row[cond::LogDBNames::LogTableName()+".PAYLOADTOKEN"].data<std::string>();
315  logentry.payloadContainer=row[cond::LogDBNames::LogTableName()+".PAYLOADCONTAINER"].data<std::string>();
316  logentry.exectime=row[cond::LogDBNames::LogTableName()+".EXECTIME"].data<std::string>();
317  logentry.execmessage=row[cond::LogDBNames::LogTableName()+".EXECMESSAGE"].data<std::string>();
318 
319  //row.toOutputStream( std::cout ) << std::endl;
320  }
321  }
323 }
std::string exectime
Definition: LogDBEntry.h:18
std::string usertext
Definition: LogDBEntry.h:10
std::string iovtimetype
Definition: LogDBEntry.h:12
unsigned int payloadIdx
Definition: LogDBEntry.h:13
DbTransaction & transaction()
Definition: DbSession.cc:153
std::string payloadToken
Definition: LogDBEntry.h:16
unsigned long long logId
Definition: LogDBEntry.h:7
int commit()
commit transaction.
DbSession m_sessionHandle
Definition: Logger.h:100
std::string payloadName
Definition: LogDBEntry.h:15
std::string destinationDB
Definition: LogDBEntry.h:8
int start(bool readOnly=false)
start transaction
unsigned long long lastSince
Definition: LogDBEntry.h:14
std::string execmessage
Definition: LogDBEntry.h:19
std::string payloadContainer
Definition: LogDBEntry.h:17
coral::ISchema & nominalSchema()
Definition: DbSession.cc:175
std::string provenance
Definition: LogDBEntry.h:9
tuple query
Definition: o2o.py:269
std::string iovtag
Definition: LogDBEntry.h:11
static std::string LogTableName()
Definition: LogDBNames.cc:7
bool cond::Logger::releaseWriteLock ( )
throw (
)

Definition at line 51 of file Logger.cc.

51  {
52  if(m_locked){
53  delete m_statusEditorHandle;
55  }
56  m_locked=false;
58  return !m_locked;
59 }
bool m_locked
Definition: Logger.h:102
DbTransaction & transaction()
Definition: DbSession.cc:153
int commit()
commit transaction.
DbSession m_sessionHandle
Definition: Logger.h:100
coral::IQuery * m_statusEditorHandle
Definition: Logger.h:103

Member Data Documentation

bool cond::Logger::m_locked
private

Definition at line 102 of file Logger.h.

bool cond::Logger::m_logTableExists
private

Definition at line 105 of file Logger.h.

SequenceManager* cond::Logger::m_sequenceManager
private

Definition at line 104 of file Logger.h.

DbSession cond::Logger::m_sessionHandle
mutableprivate

Definition at line 100 of file Logger.h.

coral::IQuery* cond::Logger::m_statusEditorHandle
private

Definition at line 103 of file Logger.h.