CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::persistency::PAYLOAD::Table Class Reference

#include <IOVSchema.h>

Inheritance diagram for cond::persistency::PAYLOAD::Table:
cond::persistency::IPayloadTable

Public Member Functions

void create () override
 
bool exists () override
 
bool getType (const cond::Hash &payloadHash, std::string &objectType) override
 
bool insert (const cond::Hash &payloadHash, const std::string &objectType, const cond::Binary &payloadData, const cond::Binary &streamerInfoData, const boost::posix_time::ptime &insertionTime)
 
cond::Hash insertIfNew (const std::string &objectType, const cond::Binary &payloadData, const cond::Binary &streamerInfoData, const boost::posix_time::ptime &insertionTime) override
 
bool select (const cond::Hash &payloadHash)
 
bool select (const cond::Hash &payloadHash, std::string &objectType, cond::Binary &payloadData, cond::Binary &streamerInfoData) override
 
 Table (coral::ISchema &schema)
 
 ~Table () override
 
- Public Member Functions inherited from cond::persistency::IPayloadTable
virtual ~IPayloadTable ()
 

Private Attributes

coral::ISchema & m_schema
 

Detailed Description

Definition at line 59 of file IOVSchema.h.

Constructor & Destructor Documentation

Table::Table ( coral::ISchema &  schema)
explicit

Definition at line 296 of file IOVSchema.cc.

296  :
297  m_schema( schema ){
298  }
cond::persistency::PAYLOAD::Table::~Table ( )
inlineoverride

Member Function Documentation

void Table::create ( )
overridevirtual

Implements cond::persistency::IPayloadTable.

Definition at line 304 of file IOVSchema.cc.

References exists(), cond::persistency::TableDescription< Types >::get(), m_schema, cond::persistency::TableDescription< Types >::setPrimaryKey(), cond::persistency::throwException(), and cond::persistency::PAYLOAD::tname.

Referenced by cond::persistency::IOVSchema::create(), and o2olib.O2OTool::execute().

304  {
305  if( exists()){
306  throwException( "Payload table already exists in this schema.",
307  "PAYLOAD::Schema::create");
308  }
309 
310  TableDescription< HASH, OBJECT_TYPE, DATA, STREAMER_INFO, VERSION, INSERTION_TIME > descr( tname );
311  descr.setPrimaryKey<HASH>();
312  createTable( m_schema, descr.get() );
313  }
static char const * tname
Definition: IOVSchema.h:48
static constexpr TimeType HASH
Definition: Time.h:37
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
bool Table::exists ( )
overridevirtual

Implements cond::persistency::IPayloadTable.

Definition at line 300 of file IOVSchema.cc.

References m_schema, and cond::persistency::PAYLOAD::tname.

Referenced by create(), and cond::persistency::IOVSchema::exists().

300  {
301  return existsTable( m_schema, tname );
302  }
static char const * tname
Definition: IOVSchema.h:48
bool Table::getType ( const cond::Hash payloadHash,
std::string &  objectType 
)
overridevirtual

Implements cond::persistency::IPayloadTable.

Definition at line 323 of file IOVSchema.cc.

References cond::persistency::Query< Types >::addCondition(), m_schema, and lumiQueryAPI::q.

Referenced by Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::getDaughterObjects(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::getObjectRef(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::getShortType(), and Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::properties().

323  {
324  Query< OBJECT_TYPE > q( m_schema );
325  q.addCondition<HASH>( payloadHash );
326  for ( auto row : q ) {
327  objectType = std::get<0>(row);
328  }
329 
330  return q.retrievedRows();
331  }
static constexpr TimeType HASH
Definition: Time.h:37
bool Table::insert ( const cond::Hash payloadHash,
const std::string &  objectType,
const cond::Binary payloadData,
const cond::Binary streamerInfoData,
const boost::posix_time::ptime &  insertionTime 
)

Definition at line 345 of file IOVSchema.cc.

References cond::Binary::copy(), cond::persistency::RowBuffer< Columns >::get(), m_schema, cond::Binary::size(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::PAYLOAD::tname, and jets_cff::version.

Referenced by BeautifulSoup.PageElement::append(), and insertIfNew().

349  {
350  std::string version("dummy");
351  cond::Binary sinfoData( streamerInfoData );
352  if( !sinfoData.size() ) sinfoData.copy( std::string("0") );
353  RowBuffer< HASH, OBJECT_TYPE, DATA, STREAMER_INFO, VERSION, INSERTION_TIME > dataToInsert( std::tie( payloadHash, objectType, payloadData, sinfoData, version, insertionTime ) );
354  bool failOnDuplicate = false;
355  return insertInTable( m_schema, tname, dataToInsert.get(), failOnDuplicate );
356  }
static char const * tname
Definition: IOVSchema.h:48
cond::Hash Table::insertIfNew ( const std::string &  objectType,
const cond::Binary payloadData,
const cond::Binary streamerInfoData,
const boost::posix_time::ptime &  insertionTime 
)
overridevirtual

Implements cond::persistency::IPayloadTable.

Definition at line 358 of file IOVSchema.cc.

References insert(), cond::persistency::makeHash(), and select().

361  {
362  cond::Hash payloadHash = makeHash( payloadObjectType, payloadData );
363  // the check on the hash existance is only required to avoid the error message printing in SQLite! once this is removed, this check is useless...
364  if( !select( payloadHash ) ){
365  insert( payloadHash, payloadObjectType, payloadData, streamerInfoData, insertionTime );
366  }
367  return payloadHash;
368  }
bool select(const cond::Hash &payloadHash)
Definition: IOVSchema.cc:315
std::string Hash
Definition: Types.h:45
cond::Hash makeHash(const std::string &objectType, const cond::Binary &data)
Definition: IOVSchema.cc:10
bool insert(const cond::Hash &payloadHash, const std::string &objectType, const cond::Binary &payloadData, const cond::Binary &streamerInfoData, const boost::posix_time::ptime &insertionTime)
Definition: IOVSchema.cc:345
bool Table::select ( const cond::Hash payloadHash)
bool Table::select ( const cond::Hash payloadHash,
std::string &  objectType,
cond::Binary payloadData,
cond::Binary streamerInfoData 
)
overridevirtual

Implements cond::persistency::IPayloadTable.

Definition at line 333 of file IOVSchema.cc.

References cond::persistency::Query< Types >::addCondition(), m_schema, and lumiQueryAPI::q.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

336  {
337  Query< DATA, STREAMER_INFO, OBJECT_TYPE > q( m_schema );
338  q.addCondition<HASH>( payloadHash );
339  for ( auto row : q ) {
340  std::tie( payloadData, streamerInfoData, objectType ) = row;
341  }
342  return q.retrievedRows();
343  }
static constexpr TimeType HASH
Definition: Time.h:37

Member Data Documentation

coral::ISchema& cond::persistency::PAYLOAD::Table::m_schema
private

Definition at line 75 of file IOVSchema.h.

Referenced by create(), exists(), getType(), insert(), and select().