Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
cetlib
cetlib
sqlite
detail
DefaultDatabaseOpenPolicy.cc
Go to the documentation of this file.
1
#include "
cetlib/sqlite/detail/DefaultDatabaseOpenPolicy.h
"
2
#include "
cetlib/sqlite/Exception.h
"
3
#include "
cetlib/sqlite/helpers.h
"
4
5
#include "sqlite3.h"
6
7
#include <cassert>
8
9
sqlite3
*
10
cet::sqlite::detail::DefaultDatabaseOpenPolicy::open
(
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);
22
throw
sqlite::Exception
{
sqlite::errors::SQLExecutionError
}
23
<<
"Failed to open SQLite database\n"
24
<<
"Return code: "
<<
rc
;
25
}
26
27
assert(db);
28
return
db;
29
}
cet::sqlite::errors::SQLExecutionError
Definition:
Exception.h:18
cet::sqlite::detail::DefaultDatabaseOpenPolicy::open
sqlite3 * open(std::string const &file_name)
Definition:
DefaultDatabaseOpenPolicy.cc:10
string
std::string string
Definition:
nybbler.cc:12
cet::sqlite::Exception
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition:
Exception.h:27
train.filename
string filename
Definition:
train.py:213
cet::sqlite::assembleNoLockURI
std::string assembleNoLockURI(std::string const &filename)
Definition:
helpers.cc:8
python.emptydir.rc
rc
Definition:
emptydir.py:177
DefaultDatabaseOpenPolicy.h
sqlite3
struct sqlite3 sqlite3
Definition:
DatabaseSupport.h:12
Exception.h
helpers.h
Generated by
1.8.11