TKeyVFSOpenPolicy.cc
Go to the documentation of this file.
5 
6 art::TKeyVFSOpenPolicy::TKeyVFSOpenPolicy(TFile* const tfile, int const flags)
7  : tfile_{tfile}, flags_{flags | SQLITE_OPEN_URI}
8 {}
9 
10 sqlite3*
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 }
sqlite3 * open(std::string const &key)
std::string string
Definition: nybbler.cc:12
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
TKeyVFSOpenPolicy(TFile *const tfile, int const flags=SQLITE_OPEN_READONLY)