Public Member Functions | List of all members
cet::sqlite::detail::DefaultDatabaseOpenPolicy Class Reference

#include <DefaultDatabaseOpenPolicy.h>

Public Member Functions

sqlite3open (std::string const &file_name)
 

Detailed Description

Definition at line 17 of file DefaultDatabaseOpenPolicy.h.

Member Function Documentation

sqlite3 * cet::sqlite::detail::DefaultDatabaseOpenPolicy::open ( std::string const &  file_name)

Definition at line 10 of file DefaultDatabaseOpenPolicy.cc.

12 {
13  sqlite3* db{nullptr};
14  auto const& uri = assembleNoLockURI(filename);
15  int const rc{sqlite3_open_v2(uri.c_str(),
16  &db,
17  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
18  SQLITE_OPEN_URI,
19  nullptr)};
20  if (rc != SQLITE_OK) {
21  sqlite3_close(db);
23  << "Failed to open SQLite database\n"
24  << "Return code: " << rc;
25  }
26 
27  assert(db);
28  return db;
29 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:27
string filename
Definition: train.py:213
std::string assembleNoLockURI(std::string const &filename)
Definition: helpers.cc:8
struct sqlite3 sqlite3

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