11 #include "cetlib_except/exception.h" 25 vector<array<string, 2u>>
const names{{{
"Cindy",
"Miller"}},
26 {{
"Billy",
"Baker"}}};
29 check_table_contents(
Connection&
c,
string const& table_name)
31 auto test_results = [](
size_t const i,
auto const& worker) {
32 auto const& [first_name, last_name] = worker;
33 assert(first_name ==
names[i][0]);
34 assert(last_name ==
names[i][1]);
37 workers <<
select(
"*").from(c, table_name);
50 string const table_name{
"Workers"};
55 for (
auto const& worker :
names) {
56 insert_into(*
c, table_name).values(worker[0], worker[1]);
59 check_table_contents(*
c, table_name);
61 string const table_name2{
"Workers2"};
67 for (
auto const& worker :
names) {
68 insert_into(*
c, table_name2).values(worker[0], worker[1]);
72 check_table_contents(*
c, table_name2);
86 check_table_contents(*
c, table_name2);
90 cerr << e.what() <<
'\n';
94 cerr <<
"Unknown exception caught.\n";
auto insert_into(sqlite3 *const db, std::string const &tablename)
void for_all_with_index(FwdCont &, Func)
auto make_connection(std::string const &file_name, PolicyArgs &&...) -> Connection *
void create_table(sqlite3 *const db, std::string const &tablename, Cols const &...cols)
auto select(T const &...t)
static std::vector< std::string > const names
cet::coded_exception< error, detail::translate > exception