ATLAS Offline Software
SQLiteDBSvc.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 /*
3  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef SQLITEDBSVC_SQLITEDBSVC_H
7 #define SQLITEDBSVC_SQLITEDBSVC_H
10 
11 // STL includes
12 #include <memory>
13 
14 // Other includes
15 #include "sqlite3.h"
16 
21 class SQLiteDBSvc : public extends<AthService, ISQLiteDBSvc> {
22  public:
24  SQLiteDBSvc(const std::string& name, ISvcLocator* svcLoc)
25  : extends(name, svcLoc), m_db(nullptr, sqlite3_close_v2) {}
27  virtual StatusCode initialize() override;
28 
36  std::string_view statement,
37  std::source_location call = std::source_location::current()) override;
38 
39  private:
40  // Thread-safe because SQLite is used in serialized mode
41  std::unique_ptr<sqlite3, int (*)(sqlite3*)> m_db ATLAS_THREAD_SAFE;
42  Gaudi::Property<std::string> m_databasePath{
43  this, "DatabasePath", ":memory:",
44  "Path to SQLite Database. The default (:memory:) creates a temporary "
45  "in-memory database. Options may be set using SQLite URI filenames."};
46 };
47 #endif // SQLITEDBSVC_SQLITEDBSVC_H
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
SQLite::Statement
SQLite prepared statement.
Definition: Statement.h:50
SQLiteDBSvc
A service to manage a connection to an SQLite DB.
Definition: SQLiteDBSvc.h:21
python.trfUtils.call
def call(args, bufsize=0, executable=None, stdin=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, message="", logger=msg, loglevel=None, timeout=None, retry=2, timefactor=1.5, sleeptime=10)
Definition: trfUtils.py:155
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SQLiteDBSvc::createStatement
virtual SQLite::Statement createStatement(std::string_view statement, std::source_location call=std::source_location::current()) override
Compile a prepared statement attached to this database.
Definition: SQLiteDBSvc.cxx:22
ISQLiteDBSvc.h
SQLiteDBSvc::ATLAS_THREAD_SAFE
std::unique_ptr< sqlite3, int(*)(sqlite3 *)> m_db ATLAS_THREAD_SAFE
Definition: SQLiteDBSvc.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
SQLiteDBSvc::SQLiteDBSvc
SQLiteDBSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition: SQLiteDBSvc.h:24
createCoolChannelIdFile.statement
statement
Definition: createCoolChannelIdFile.py:40
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
AthService.h
SQLiteDBSvc::initialize
virtual StatusCode initialize() override
Initialize.
Definition: SQLiteDBSvc.cxx:7
SQLiteDBSvc::m_databasePath
Gaudi::Property< std::string > m_databasePath
Definition: SQLiteDBSvc.h:42