ATLAS Offline Software
Loading...
Searching...
No Matches
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
21class 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) {}
26
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
std::unique_ptr< sqlite3, int(*)(sqlite3 *)> m_db ATLAS_THREAD_SAFE
Definition SQLiteDBSvc.h:41
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.
Gaudi::Property< std::string > m_databasePath
Definition SQLiteDBSvc.h:42
virtual StatusCode initialize() override
Initialize.
SQLiteDBSvc(const std::string &name, ISvcLocator *svcLoc)
Constructor.
Definition SQLiteDBSvc.h:24
SQLite prepared statement.
Definition Statement.h:50