13 enum DBTYPE { SQLITE3_TKEYDB, SQLITE3_MEMDB, SQLITE3_FILEDB, SQLITE3_TMPDB };
16 dbTypeAsString(
DBTYPE type)
40 traceit(
void* string_ptr,
const char* zSQL)
44 <<
"+ SQLTrace (" << *
reinterpret_cast<std::string*
>(string_ptr)
58 std::string
const&
key,
68 static char const* s_debug = getenv(
"ART_DEBUG_SQL");
112 DBTYPE type = tfile ? SQLITE3_TKEYDB :
114 (
key_ ==
":memory:" ? SQLITE3_MEMDB : SQLITE3_FILEDB) :
120 <<
"Failed to open TKEYVFS DB due to empty key spec.\n";
125 err = sqlite3_open(
key_.c_str(), &
db_);
128 err = sqlite3_open_v2(
key_.c_str(), &
db_, flags,
nullptr);
131 err = sqlite3_open(
key_.c_str(), &
db_);
136 <<
"Failed to open requested DB, \"" <<
key_ <<
"\" of type, \"" 137 << dbTypeAsString(type) <<
"\" -- " << sqlite3_errmsg(
db_) <<
"\n";
147 sqlite3_trace(
db_, traceit, const_cast<std::string*>(&
key_));
void swap(SQLite3Wrapper &other)
static bool wantTracing()
void initDB(int flags, TFile *tfile=0)
int tkeyvfs_open_v2(const char *filename, sqlite3 **ppDb, int flags, TFile *rootFile )
std::string const & key() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
MaybeLogger_< ELseverityLevel::ELsev_severe, true > LogAbsolute