DefaultDatabaseOpenPolicy.cc
Go to the documentation of this file.
4 
5 #include "sqlite3.h"
6 
7 #include <cassert>
8 
9 sqlite3*
11  std::string const& filename)
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 }
sqlite3 * open(std::string const &file_name)
std::string string
Definition: nybbler.cc:12
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