13 if (filename.substr(0, 5) ==
"file:") {
15 <<
"art does not allow an SQLite database filename that starts with " 17 <<
"Please contact artists@fnal.gov if you believe this is an error.";
19 return "file:" + filename +
"?nolock=1";
35 .from(db,
"sqlite_master")
36 .where(
"type=\"table\" and name=\""s + name +
'"');
52 if (retrievedSchema == expectedSchema) {
57 <<
"Existing database table name does not match the expected schema:\n" 58 <<
" Schema on disk : " << retrievedSchema <<
'\n' 59 <<
" Expected schema: " << expectedSchema <<
'\n';
65 exec(db,
"delete from "s + tablename +
';');
71 exec(db,
"drop table "s + tablename +
';');
78 exec(db,
"drop table if exists "s + tablename +
';');
85 r <<
select(
"count(*)").from(db, tablename);
bool hasTableWithSchema(sqlite3 *db, std::string const &tablename, std::string expectedSchema)
void delete_from(sqlite3 *db, std::string const &tablename)
T unique_value(query_result< T > const &r)
void normalize_statement(std::string &to_replace)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::string assembleNoLockURI(std::string const &filename)
void drop_table_if_exists(sqlite3 *db, std::string const &tablename)
auto select(T const &...t)
void drop_table(sqlite3 *db, std::string const &tablename)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
unsigned nrows(sqlite3 *db, std::string const &tablename)
void exec(sqlite3 *db, std::string const &ddl)