CMS 3D CMS Logo

OMDSReader.h

Go to the documentation of this file.
00001 #ifndef CondTools_L1Trigger_OMDSReader_h
00002 #define CondTools_L1Trigger_OMDSReader_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     L1Trigger
00006 // Class  :     OMDSReader
00007 // 
00016 //
00017 // Original Author:  Werner Sun
00018 //         Created:  Sun Mar  2 01:36:06 CET 2008
00019 // $Id: OMDSReader.h,v 1.4 2008/07/23 16:38:08 wsun Exp $
00020 //
00021 
00022 // system include files
00023 #include <memory>
00024 #include "boost/shared_ptr.hpp"
00025 
00026 // user include files
00027 #include "CondCore/DBCommon/interface/CoralTransaction.h"
00028 #include "CondTools/L1Trigger/interface/DataManager.h"
00029 #include "RelationalAccess/IQuery.h"
00030 #include "CoralBase/AttributeList.h"
00031 #include "CoralBase/AttributeSpecification.h"
00032 #include "CoralBase/Attribute.h"
00033 
00034 // forward declarations
00035 
00036 namespace l1t
00037 {
00038 
00039   class OMDSReader : public DataManager
00040   {
00041 
00042   public:
00043     OMDSReader( const std::string& connectString,
00044                 const std::string& authenticationPath ) ;
00045 
00046     virtual ~OMDSReader();
00047 
00048       // ---------- const member functions ---------------------
00049 
00050       // std::vector< std::string > is the list of attribute names.
00051       // We need this typedef because there is no way to ask AttributeList
00052       // for its attribute names.  We have a vector of AttributeLists because
00053       // the query may return more than one row, each of which is encapsulated
00054       // in an AttributeList.
00055       typedef
00056         std::pair< std::vector< std::string >,
00057         std::vector< coral::AttributeList > >
00058         QueryResults ;
00059 
00060       // These functions encapsulate basic SQL queries of the form
00061       //
00062       // SELECT <columns> FROM <schema.table> WHERE <conditionLHS> = <conditionRHS>
00063       //
00064       // where
00065       //
00066       // <columns> can be one or many column names
00067       // <conditionRHS> can be a string or the result of another query
00068 
00069       const QueryResults basicQuery(
00070         const std::vector< std::string >& columnNames,
00071         const std::string& schemaName, // for nominal schema, use ""
00072         const std::string& tableName,
00073         const std::string& conditionLHS = "",
00074         const QueryResults conditionRHS = QueryResults(),
00075                                                    // must have only one row
00076         const std::string& conditionRHSName = ""
00077                          // if empty, conditionRHS must have only one column
00078         ) const ;
00079 
00080       const QueryResults basicQuery(
00081         const std::string& columnName,
00082         const std::string& schemaName, // for nominal schema, use ""
00083         const std::string& tableName,
00084         const std::string& conditionLHS = "",
00085         const QueryResults conditionRHS = QueryResults(),
00086                                                    // must have only one row
00087         const std::string& conditionRHSName = ""
00088                          // if empty, conditionRHS must have only one column
00089         ) const ;
00090 
00091       const QueryResults singleAttribute( const std::string& data ) const ;
00092 
00093       // ---------- static member functions --------------------
00094 
00095       // ---------- member functions ---------------------------
00096 
00097    private:
00098       OMDSReader(const OMDSReader&); // stop default
00099 
00100       const OMDSReader& operator=(const OMDSReader&); // stop default
00101 
00102       // ---------- member data --------------------------------
00103       cond::CoralTransaction* m_coralTransaction ;
00104 };
00105 
00106 }
00107 #endif

Generated on Tue Jun 9 17:26:54 2009 for CMSSW by  doxygen 1.5.4