Public Member Functions | Private Attributes | List of all members
art::TKeyVFSOpenPolicy Class Reference

#include <TKeyVFSOpenPolicy.h>

Public Member Functions

 TKeyVFSOpenPolicy (TFile *const tfile, int const flags=SQLITE_OPEN_READONLY)
 
sqlite3 * open (std::string const &key)
 

Private Attributes

TFile * tfile_
 
int flags_
 

Detailed Description

Definition at line 11 of file TKeyVFSOpenPolicy.h.

Constructor & Destructor Documentation

art::TKeyVFSOpenPolicy::TKeyVFSOpenPolicy ( TFile *const  tfile,
int const  flags = SQLITE_OPEN_READONLY 
)
explicit

Definition at line 6 of file TKeyVFSOpenPolicy.cc.

7  : tfile_{tfile}, flags_{flags | SQLITE_OPEN_URI}
8 {}

Member Function Documentation

sqlite3 * art::TKeyVFSOpenPolicy::open ( std::string const &  key)

Definition at line 11 of file TKeyVFSOpenPolicy.cc.

12 {
13  if (!key.size()) {
15  << "Failed to open TKEYVFS DB due to empty key spec.\n";
16  }
17 
18  auto const uriKey = cet::sqlite::assembleNoLockURI(key);
19  sqlite3* db{nullptr};
20  int const rc{tkeyvfs_open_v2(uriKey.c_str(), &db, flags_, tfile_)};
21  if (rc != SQLITE_OK) {
23  << "Failed to open requested DB, \"" << key << "\" of type, \""
24  << "tkeyvfs (unexpected status of " << rc << ")\n"
25  << sqlite3_errmsg(db) << '\n';
26  }
27  return db;
28 }
std::string assembleNoLockURI(std::string const &filename)
Definition: helpers.cc:10
int tkeyvfs_open_v2(const char *filename, sqlite3 **ppDb, int flags, TFile *rootFile )
Definition: tkeyvfs.cc:1837
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Data Documentation

int art::TKeyVFSOpenPolicy::flags_
private

Definition at line 20 of file TKeyVFSOpenPolicy.h.

TFile* art::TKeyVFSOpenPolicy::tfile_
private

Definition at line 19 of file TKeyVFSOpenPolicy.h.


The documentation for this class was generated from the following files: